AOJ 0123 Speed Skating Badge Test
問題
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0123
解法
やらないだけ
#include <cstdio> #include <algorithm> using namespace std; const double t500[7] = { 35.50,37.50,40.00,43.00,50.00,55.00,70.00 }; const double t1000[7] = { 71.00,77.00,83.00,89.00,105.00,116.00,148.00}; const char rank[7][4] = { "AAA", "AA", "A", "B", "C", "D", "E" }; int main(){ double a, b; while(scanf("%lf %lf", &a, &b)!= EOF){ bool f = false; for(int i = 0; i < 7; i++){ if(a < t500[i] && b < t1000[i]){ f = true; printf("%s\n", &rank[i][0]); break; } } if(!f) puts("NA"); } return 0; }