CSU 1507 超大型LED显示屏
来源:互联网 发布:mysql 最后一行合计 编辑:程序博客网 时间:2024/04/28 13:56
Description
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: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
Sample Output
Case 1: 9672Case 2: 478800
#include <stdio.h>#include <string.h>int k[10]={6,2,5,5,4,5,6,3,7,6};int ff(int n){ int sum=0; if(n==0) return 6; while(n) { int temp=n%10; n/=10; sum+=k[temp]; } return sum;}int tt(int d,int e,int f,int a,int b,int c){ if(c>f) { f+=60; e--; } if(b>e) { e+=60; d--; } return 3600*(d-a)+60*(e-b)+f-c;}int main(){ int i,j,f1,f2; char a[10],b[10]; int sh,sm,ss,h,m,s,num,h1,h2,m1,m2,s1,s2,t=1; long long sum1,sum2; while(~scanf("%s %d:%d:%d",a,&sh,&sm,&ss)) { sum1=sum2=0; h1=h2=sh; m1=m2=sm; s1=s2=ss; f1=f2=0; if(strcmp(a,"START")==0) { while(~scanf("%s %d:%d:%d",a,&h,&m,&s)) { if(a[0]=='E') break; scanf("%s %d",b,&num); if(strcmp(a,"SCORE")==0) { if(strcmp(b,"home")==0) { if(sum1==0) { sum1+=6*tt(h,m,s,sh,sm,ss); f1=num; h1=h,m1=m,s1=s; } else { sum1+=ff(f1)*tt(h,m,s,h1,m1,s1); f1+=num; h1=h,m1=m,s1=s; } } else { if(sum2==0) { sum2+=6*(tt(h,m,s,sh,sm,ss)); f2=num; h2=h,m2=m,s2=s; // printf("%lld %d %d\n",sum2,ff(f2),tt(h,m,s,sh,sm,ss)); } else { sum2+=ff(f2)*tt(h,m,s,h2,m2,s2); f2+=num; h2=h,m2=m,s2=s; } } } } sum1+=ff(f1)*(tt(h,m,s,h1,m1,s1)); sum2+=ff(f2)*(tt(h,m,s,h2,m2,s2)); printf("Case %d: %lld\n",t++,sum1+sum2); } } return 0;}
0 0
- CSU 1507 超大型LED显示屏
- CSU 1507 超大型LED显示屏
- CSU-1507 超大型LED显示屏
- CSU OJ1507超大型LED显示屏
- CSU 1507: 超大型LED显示屏(数学啊)
- csu 1507: 超大型LED显示屏(要重新敲一遍)
- 超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏
- CSU_1507_超大型LED显示屏
- 超大型led显示屏
- O-超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏
- 超大型LED显示屏(模拟)
- 湖南2014CPC 超大型LED显示屏
- CSU1507 超大型LED显示屏_模拟题
- 湖南省第十届大学生计算机程序设计竞赛(原题) 第E题 超大型LED显示屏
- 通讯录系统 (C语言 控制台应用程序)
- 使用cocoaPods,pch提示找不到文件或者导入文件不智能索引的解决方案
- "Optimize Game Objects" in ModelImporter inspector
- ToolBar修改menu item的字体颜色
- hive命令行小窍门
- CSU 1507 超大型LED显示屏
- javascript 记录按键动作和按键时间
- Andoird 自定义ViewGroup实现竖向引导界面
- Android 图片内存溢出处理笔记
- ffmpeg中swscale 的用法
- 密码长度6位以上且须包含大写、小写、数字、特殊符号中的任意3种
- 工作反思3
- Spring
- linux中断--中断下半部机制的使用&中断编程