超大型LED显示屏
来源:互联网 发布:淘宝网买家可以贷款吗 编辑:程序博客网 时间:2024/04/29 02:05
输入包含不超过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秒钟。
对于每组数据,输出测试点编号和总耗电量。
START 09:00:00SCORE 09:01:05 home 2SCORE 09:10:07 guest 3END 09:15:00START 09:00:00SCORE 10:00:00 home 1SCORE 11:00:00 home 1SCORE 12:00:00 home 1SCORE 13:00:00 home 1SCORE 14:00:00 home 1SCORE 15:00:00 home 1SCORE 16:00:00 home 1SCORE 17:00:00 home 1SCORE 18:00:00 home 1SCORE 19:00:00 home 1SCORE 20:00:00 home 1END 21:00:00
Case 1: 9672Case 2: 478800
这题呢就是比拼耐心了,题目其实不是很难,关键的就是讲他的0-9存进来的时候直接变成需要消耗的电能
#include<cstdio>#include<cstring>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
struct time
{
int h,m,s;
}times;
int snake,edg = 0,skt = 0;
int fenshu[] = {6,2,5,5,4,5,6,3,7,6};
int summer(int x)
{
int rng = 0;
if(x == 0)
return 6;
else
{
while(x)
{
rng+=fenshu[x%10];
x/=10;
}
}
return rng;
}
int main()
{
int sum = 0,hour,min,s,case1 =1;
char xx[10];
while(~scanf("%s",xx))
{
if(xx[1] == 'T')
{
scanf("%d:%d:%d",&hour,&min,&s);
times.h = hour;
times.m = min;
times.s = s;
}
else if(xx[1] == 'C')
{
char team[10];
int suml;
scanf("%d:%d:%d %s %d",&hour,&min,&s,team,&snake);
suml=(hour*3600-times.h*3600)+(min*60-times.m*60)+s-times.s;
times.h = hour;
times.m = min;
times.s = s;
int ll = summer(edg);
int rr = summer(skt);
sum+=suml*ll+suml*rr;
if(team[0] == 'h')
edg+=snake;
else
skt+=snake;
}
else if(xx[1] == 'N')
{
scanf("%d:%d:%d",&hour,&min,&s);
int sumr;
sumr=(hour*3600-times.h*3600)+(min*60-times.m*60)+s-times.s;
int ll = summer(edg);
int rr = summer(skt);
sum+=sumr*ll+sumr*rr;
printf("Case %d: %d\n",case1,sum);
sum = 0;
edg = 0;
skt = 0;
case1++;
}
}
return 0;
}
阅读全文
0 0
- 超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏
- CSU_1507_超大型LED显示屏
- 超大型led显示屏
- O-超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- CSU-1507 超大型LED显示屏
- CSU OJ1507超大型LED显示屏
- 超大型LED显示屏(模拟)
- 湖南2014CPC 超大型LED显示屏
- CSU1507 超大型LED显示屏_模拟题
- CSU 1507: 超大型LED显示屏(数学啊)
- csu 1507: 超大型LED显示屏(要重新敲一遍)
- 湖南省第十届大学生计算机程序设计竞赛(原题) 第E题 超大型LED显示屏
- 基于多种分隔符进行字符串的分割
- SVM入门(2)--对偶
- html5 获取摄像头和麦克风的案例
- 多重背包二进制优化 && Hdu 1059
- PHP进阶(第四弹:会话控制)
- 超大型LED显示屏
- UVA
- shell学习十一--bc
- redis-Jedispool学习
- CodeForces
- maven搭建项目--实现mybatis增删改差、一对多及一对一关系
- GCJ 2008 Round1A A Minimum Scalar Product
- gdb调试
- UVA-10128 Queue