您的位置:首页 > 其它

J - 超大型LED显示屏

2017-08-07 11:51 295 查看
#include
#include
#include
#include
#include
#pragma warning(disable:4996)
using namespace std;
int show[10] = { 6,2,5,5,4,5,6,3,7,6 };
int get(int a)
{
int sum = 0;
if (a == 0)
return 6;
while (a)
{
sum += show[a % 10];
a /= 10;
}
return sum;
}
int main()
{
int a,b,c,statime,endtime,d,time,arr[100],count=1;
char s[100],st[100];
while (~scanf("%s %d:%d:%d", s,&a,&b,&c))
{
memset(arr, 0, sizeof(arr));
statime = a * 3600 + b * 60 + c;
int num = 0;
while (1)
{
scanf("%s %d:%d:%d", s, &a, &b, &c);
if (strcmp(s, "END") == 0)
{
endtime = a * 3600 + b*60 + c;
break;
}
scanf("%s %d", st, &d);
time= a * 3600 + b*60 + c;
num+= (get(arr[1]) + get(arr[0]))*(time - statime);
statime = time;
if (strcmp(st, "home") == 0)
arr[0] += d;
else
arr[1] += d;
}
num+= (get(arr[1]) + get(arr[0]))*(endtime - statime);
printf("Case %d: ", count++);
printf("%d\n", num);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  有点复杂的水题