U E D R , A S I H C RSS

algorithm Study/2014/Hard_Disk_Drive


#pragma warning(disable : 4996)


#include<stdio.h>
#include<string.h>
#define LOSS 125/128
int main(){
	int repeat_num; 
	int i = 0;
	int j = 0;
	char data_case[9] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
	char test_string[10]; 
	char data_input;
	float temp = 1;
	float loss = 1;
	scanf("%d", &repeat_num);
	for (i = 1; i <= repeat_num; i++)
	{
		temp = 1;
		loss = 0;
		j = 0;
		scanf("%s", test_string); 

		while (test_string[j++] != '[');
		
		data_input = test_string[j];
		j = 0;
		while (data_case[j++] != data_input) {
			temp = temp * ((float)125/(float)128);
		}

		loss = 1 - temp;
		printf("Case #%d = %.2f\%\n", i,  100 * loss);
				

	}

}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:36
Processing time 0.0143 sec