标签:lan += col hdoj cin targe acm AC strong
题目链接:Average is not Fast Enough!
1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include <cstdio> 5 using namespace std; 6 int main() 7 { 8 int n, id; 9 double d; 10 cin>>n>>d; 11 while (cin>>id) { 12 printf("%3d: ", id); 13 int mark = 0; 14 int time = 0; 15 for (int i=0; i<n; i++) { 16 string str; 17 cin>>str; 18 if (str[0] == ‘-‘) { 19 mark = 1; 20 // printf("-\n");不能在这里输出,因为会碰到多个不及格的,WA了数次 21 } 22 if(mark==1)continue; 23 time += (str[0]-‘0‘) * 3600+ ((str[2]-‘0‘)*10+(str[3]-‘0‘)) * 60 + (str[5]-‘0‘)*10+(str[6]-‘0‘); 24 } 25 if (mark == 1) { 26 printf("-\n"); 27 continue; 28 } 29 double a = time / d; 30 int t = (int)(a + 0.5); 31 printf("%d:%02d min/km\n", t/60, t%60); 32 } 33 return 0; 34 }
hdoj-1036-Average is not Fast Enough!(水题,坑)
标签:lan += col hdoj cin targe acm AC strong
原文地址:https://www.cnblogs.com/evidd/p/8991682.html