1999 LSU Computer Science High School Programming Contest
Veteran Problem 8
Just how fast is my cpu?

Return to the Top of Page, First Page, or Veteran Problem Set.


Problem Statement

Your job is to benchmark a series of computers. You will read in a computer name, how many clock cycles to do integer operations, how many clock cycles to do floating point operations and the clock speed (in MHz). You are to then run the "Really Bogus Test Suite" on this processor:


The Scientific Mix is a mixture of integer and floating point operations that simulates the mixture of operations that occur in normal scientific computation. The Business Mix is a mixture of integer and floating point operations that occur in normal business computation. The Index Mix is a general purpose mixture of integer and floating point operations that simulates normal computing.

The string "FFFFIFFFFIIFFIF" describes the mixture of integer and floating point operations that make up this benchmark. Each "F" represents a floating point operation. Each "I" represents an integer operation.

To compute a mix, you divide the clockspeed of the processor by the sum of the number of clock cycles it will take to complete the indicated operations.

Your input will be:

Sample Input Data:

Pentium-99 
3 
7 
650
PPC-4 
4 
6 
633
Alpha-IV 
2 
3 
315
MIPS-2000 
12 
12 
500
nevermore

NOTE: Your program should terminate when it encounters a processor named "nevermore".

As an example, let's calculate the "Really Bogus Test Suite" for the Pentium-99. The Scientific Mix of FFFFIFFFFIIFFIF would calculated in the following way:

650/(7+7+7+7+3+7+7+7+7+3+3+7+7+3+7) = 7.3

The Business Mix of IIIFIIIIFIIIFIIIIF would calculated in the following way:

650/(3+3+3+7+3+3+3+3+7+3+3+3+7+3+3+3+3+7) = 9.3

The Index Mix of IIIIIIIIIFIIIF would calculated in the following way:

650/(3+3+3+3+3+3+3+3+3+7+3+3+3+7)=13.0

Sample Output:

Pentium-99
   Scientific Mix: 7.3
   Business Mix: 9.3
   Index Mix: 13.0
PPC-4
   Scientific Mix: 7.7
   Business Mix: 7.9
   Index Mix: 10.6
Alpha-IV
   Scientific Mix: 7.7
   Business Mix: 7.9
   Index Mix: 10.5
MIPS-2000
   Scientific Mix: 2.8
   Business Mix: 2.3
   Index Mix: 3.0

Note: All results should be displayed with only one (1) decimal place (one digit to the right of the decimal point). This digit should be rounded off (5 and larger goes up, 4 and down round down). Exact spacing of numeric output is not critical. Precision (exactly one (1) digit to the right of the decimal point) is critical.



Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Clarifications:







Return to the Top of Page, First Page, or Veteran Problem Set.


Source Code for a Solution to this Problem

#include <stdio.h>
#include <string.h>

void main()
{
 char cpu[80], *myEOF="nevermore";
 int  fpop=0, intop=0, clockspeed=0;
 const int smixfp=11, smixint=4, bmixfp=4, bmixint=14, imixfp=2, imixint=12;

	scanf("%s",cpu);
	while((strcmp(cpu,myEOF))!=0)
	{
		scanf("%d\n",&intop);
		scanf("%d\n",&fpop);
		scanf("%d\n",&clockspeed);
		printf("%s\n",cpu);
		printf("   Scientific Mix: %2.1f\n",(float)(clockspeed/(float)((smixfp*fpop)+(smixint*intop))));
		printf("   Business Mix: %2.1f\n",(float)(clockspeed/(float)((bmixfp*fpop)+(bmixint*intop))));
		printf("   Index Mix: %2.1f\n",(float)(clockspeed/(float)((imixfp*fpop)+(imixint*intop))));
		scanf("%s",cpu);
	}
}


Return to the Top of Page, First Page, or Veteran Problem Set.

Sample Input

Pentium-99 
3 
7 
650
PPC-4 
4 
6 
633
Alpha-IV 
2 
3 
315
MIPS-2000 
12 
12 
500
nevermore

Return to the Top of Page, First Page, or Veteran Problem Set.


Sample Output

Pentium-99
   Scientific Mix: 7.3
   Business Mix: 9.3
   Index Mix: 13.0
PPC-4
   Scientific Mix: 7.7
   Business Mix: 7.9
   Index Mix: 10.6
Alpha-IV
   Scientific Mix: 7.7
   Business Mix: 7.9
   Index Mix: 10.5
MIPS-2000
   Scientific Mix: 2.8
   Business Mix: 2.3
   Index Mix: 3.0

Return to the Top of Page, First Page, or Veteran Problem Set.


Judge Data Set 1 - Input

cpu_1-0
1
1
100
cpu_1-1
10
5
133
cpu_1-2
1
2
233
cpu_1-3
2
1
233
cpu_1-4
35
74
12345
nevermore

Return to the Top of Page, First Page, or Veteran Problem Set.


Judge Data Set 1 - Output

cpu_1-0
   Scientific Mix: 6.7
   Business Mix: 5.6
   Index Mix: 7.1
cpu_1-1
   Scientific Mix: 1.4
   Business Mix: 0.8
   Index Mix: 1.0
cpu_1-2
   Scientific Mix: 9.0
   Business Mix: 10.6
   Index Mix: 14.6
cpu_1-3
   Scientific Mix: 12.3
   Business Mix: 7.3
   Index Mix: 9.0
cpu_1-4
   Scientific Mix: 12.9
   Business Mix: 15.7
   Index Mix: 21.7

Return to the Top of Page, First Page, or Veteran Problem Set.


Judge Data Set 2 - Input

cpu_2-0
2
1
100
cpu_2-1
10
10
133
cpu_2-2
13
27
233
cpu_2-3
25
17
233
cpu_2-4
5
20
450
nevermore

Return to the Top of Page, First Page, or Veteran Problem Set.


Judge Data Set 2 - Output

cpu_2-0
   Scientific Mix: 5.3
   Business Mix: 3.1
   Index Mix: 3.8
cpu_2-1
   Scientific Mix: 0.9
   Business Mix: 0.7
   Index Mix: 0.9
cpu_2-2
   Scientific Mix: 0.7
   Business Mix: 0.8
   Index Mix: 1.1
cpu_2-3
   Scientific Mix: 0.8
   Business Mix: 0.6
   Index Mix: 0.7
cpu_2-4
   Scientific Mix: 1.9
   Business Mix: 3.0
   Index Mix: 4.5

Return to the Top of Page, First Page, or Veteran Problem Set.


The statements and opinions included in these pages are those of the LSU High School Programming Contest Staff only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999 LSU High School Programming Contest

Return to the LSU High School Programming Contest Homepage