首页 > 其他 > 详细

hdoj-1036-Average is not Fast Enough!(水题,坑)

时间:2018-05-04 18:05:06      阅读:159      评论:0      收藏:0      [点我收藏+]

 题目链接: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!(水题,坑)

原文:https://www.cnblogs.com/evidd/p/8991682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!