#14591: 69


brian940608@gmail.com (20636)

School : 臺北市私立延平高級中學
ID : 67134
IP address : [49.159.146.243]
Last Login :
2023-04-03 13:24:39
a864. 4. Stellar Classification -- HP CodeWars2010 | From: [203.72.178.252] | Post Date : 2018-07-25 13:22

#include<stdio.h> #include<string.h> int main(){ char name[100] ; double B ,V ; while (scanf("%s%lf%lf",&name ,&B ,&V ) && strcmp(name,"END")!=0 ){ printf("%s %.2lf ",name ,B-V ) ; double d=B-V ; if (d < -0.25)printf("O") ; else if (d < 0.0 )printf("B") ; else if (d < 0.25)printf("A") ; else if (d < 0.5 )printf("F") ; else if (d < 1.0 )printf("G") ; else if (d < 1.5 )printf("K") ; else printf("M") ; printf("\n") ; } }

 
ZeroJudge Forum