#14592: 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:24

#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") ; } }

 
#22040: Re:69


753951852456 (精神小伙不請自來)

School : 臺北市私立延平高級中學
ID : 103367
IP address : [203.72.178.3]
Last Login :
2022-04-13 12:40:32
a864. 4. Stellar Classification -- HP CodeWars2010 | From: [203.72.178.252] | Post Date : 2020-08-11 14:02

#include

#include

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