湖南2014CPC 超大型LED显示屏
2015-04-30 20:04
330 查看
Description
![](http://acm.csu.edu.cn/OnlineJudge/upload/201410/e.jpg)
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 <iostream>
#include <cstdio>
#include <cstring>
#include<algorithm>
using namespace std;
struct time
{
int h;
int m;
int s;
} btime;
int sc,hsc=0,gsc=0;
int score[10]= {6,2,5,5,4,5,6,3,7,6};
int howtiao(int x)
{
int ss=0;
if(x==0)
return 6;
else
{
while(x)
{
ss+=score[x%10];
x/=10;
}
return ss;
}
}
int main()
{
int sum=0,h,m,s,cas=1;
char st[10];
while(scanf("%s",st)!=EOF)
{
if(st[1]=='T')
{
scanf("%d:%d:%d",&h,&m,&s);//输入开始时间
btime.h=h;
btime.m=m;
btime.s=s;
}
else if(st[1]=='N')
{
scanf("%d:%d:%d",&h,&m,&s);//输入结束时间
int sumh;//从上次到现在的消耗;
sumh=(h*3600-btime.h*3600)+(m*60-btime.m*60)+s-btime.s;//时间
int hcost=howtiao(hsc);
int gcost=howtiao(gsc);
sum+=sumh*hcost+sumh*gcost;
printf("Case %d: %d\n",cas,sum);
sum=0;
hsc=0;
gsc=0;
cas++;
}
else if(st[1]=='C')
{
char team[10];
scanf("%d:%d:%d %s %d",&h,&m,&s,team,&sc);
int sumh;//从上次到现在的消耗;
sumh=(h*3600-btime.h*3600)+(m*60-btime.m*60)+s-btime.s;//时间
btime.h=h;
btime.m=m;
btime.s=s;
int hcost=howtiao(hsc);
int gcost=howtiao(gsc);
sum+=sumh*hcost+sumh*gcost;
if(team[0]=='h')
{
hsc+=sc;
}
else
{
gsc+=sc;
}
}
}
return 0;
}
相关文章推荐
- CSU 1507 超大型LED显示屏 第十届湖南省赛题
- CSU 1507 超大型LED显示屏
- CSU_1507_超大型LED显示屏
- J - 超大型LED显示屏
- J - 超大型LED显示屏
- 超大型LED显示屏
- csu 1507: 超大型LED显示屏(要重新敲一遍)
- 超大型LED显示屏
- 超大型LED显示屏(模拟)
- 湖南2014CPC 题目 C. 酷酷的单词
- 超大型 LED 显示屏
- CSU1507 超大型LED显示屏_模拟题
- 超大型LED显示屏
- csuoj 1507: 超大型LED显示屏
- 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- CSU 1507: 超大型LED显示屏(数学啊)
- O-超大型LED显示屏
- MC9S12XS128驱动LEDP10显示屏
- 联诚发(LCF)防水LED显示屏新技术领航业界