超大型LED显示屏(模拟)
2017-08-07 21:06
316 查看
Input
输入包含不超过100组数据。每组数据第一行为”START hh:mm:ss”,表示比赛开始时刻为hh:mm:ss。最后一行为”END hh:mm:ss”,即比赛结束时刻。二者之间至少会有一个SCORE信息,格式为”SCORE hh:mm:ss team score”,其中team要么是”home”(主场)要么是”guest”(客场), score表示得分,为1,2或者3。这些信息保证按照时间从早到晚的顺序排列,且任意两条SCORE信息的时刻均不相同。比赛开始时间不会早于9:00,结束时间不会晚于同一天的21:00。注意,如果比赛开始时间为09:00:00,结束时间为09:00:01,比赛长度为1秒钟,而不是2秒钟。
Output
对于每组数据,输出测试点编号和总耗电量。
Sample Input
START 09:00:00
SCORE 09:01:05 home 2
SCORE 09:10:07 guest 3
END 09:15:00
START 09:00:00
SCORE 10:00:00 home 1
SCORE 11:00:00 home 1
SCORE 12:00:00 home 1
SCORE 13:00:00 home 1
SCORE 14:00:00 home 1
SCORE 15:00:00 home 1
SCORE 16:00:00 home 1
SCORE 17:00:00 home 1
SCORE 18:00:00 home 1
SCORE 19:00:00 home 1
SCORE 20:00:00 home 1
END 21:00:00
Sample Output
Case 1: 9672
Case 2: 478800
分析:模拟题
注意输入的开始和结束
#include<cstdio> #include<cstring> #include<algorithm> #include<vector> #include<queue> #include<cmath> using namespace std; #define mem(a,n) memset(a,n,sizeof(a)) const double INF=0x3f3f3f3f+1.0; const double eps=1e-6; typedef long long LL; int fen[10]= {6,2,5,5,4,5,6,3,7,6}; int fun(int n) { int ans=0; if(n==0) return 6; while(n) { ans+=fen[n%10]; n/=10; } return ans; } int main() { char str[10]; int times[3]; int ans,cas=1; int star,endd; while(~scanf("%s",str)) { int h,m,s; if(!strcmp(str,"START")) { ans=0; mem(times,0); scanf("%d:%d:%d",&h,&m,&s); star=3600*h+60*m+s; // printf("star=%d\n",star); // continue; } while(~scanf("%s",str)) { scanf("%d:%d:%d",&h,&m,&s); if(!strcmp(str,"END")) { endd=3600*h+60*m+s; ans=ans+(endd-star)*(fun(times[1])+fun(times[0])); // printf("ans=%d\n",ans); break; } else { int score,t; char str2[10]; scanf("%s %d",str2,&score); t=3600*h+60*m+s; // printf("t=%d\n",t); ans=ans+(t-star)*(fun(times[1])+fun(times[0])); // printf("ans=%d\n",ans); star=t; if(!strcmp(str2,"home")) times[0]+=score; else times[1]+=score; } } printf("Case %d: %d\n",cas++,ans); } return 0; }
相关文章推荐
- 超大型 LED 显示屏
- CSU 1507 超大型LED显示屏 第十届湖南省赛题
- CSU1507 超大型LED显示屏_模拟题
- 超大型LED显示屏
- CSU 1507: 超大型LED显示屏(数学啊)
- 在 WindowMobile 上的模拟LED 显示屏插件(转)
- csu 1507: 超大型LED显示屏(要重新敲一遍)
- 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- O-超大型LED显示屏
- Led控件(2)——Led显示屏模拟
- J - 超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- 湖南2014CPC 超大型LED显示屏
- CSU_1507_超大型LED显示屏
- 【今日插件】在 WindowMobile 上的模拟LED 显示屏插件
- csuoj 1507: 超大型LED显示屏
- J - 超大型LED显示屏