Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1507
Problem-solving ideas: This is a simulation problem, read so many people's code, I think my code is the simplest, haha, in fact, the score changes in the time to calculate the lamp light number of complex, I was directly violent
AC Code:
#include <iostream>#include<cstdio>#include<cstdlib>#include<cstring>using namespacestd;Const intm=45000;intc[Ten]={6,2,5,5,4,5,6,3,7,6};Chara[5],b[5];structnode{intx, Y, Z;} T[M];intMain () {intCa=1; while(1) { inti=-1, g=0, h=0, X1,Y1,Z1; Long Longsum=0; while(SCANF ("%s", a)! =EOF) {scanf ("%d:%d:%d",&x1,&y1,&Z1); I++; t[i].x=x1;t[i].y=y1;t[i].z=Z1; intAns= (t[i].x-t[i-1].x) *3600+ (t[i].y-t[i-1].Y) * -+t[i].z-t[i-1].z; if(strcmp (A,"START")==0)Continue; if(h> About) {sum+=ans* (c[h/ -]+c[h/Ten%Ten]+c[h%Ten]);} Else if(h>9) {sum+=ans* (c[h/Ten]+c[h%Ten]);} ElseSum+=ans* (c[h%Ten]); if(g> About) {sum+=ans* (c[g/ -]+c[g/Ten%Ten]+c[g%Ten]);} Else if(g>9) {sum+=ans* (c[g/Ten]+c[g%Ten]);} Else{sum+=ans* (c[g%Ten]);}if(strcmp (A,"END")==0) Break; intx2; scanf ("%s%d",b,&x2); if(strcmp (b,"Home")) h+=x2; Else if(strcmp (b,"Guest")) g+=x2; } if(i==-1) Break; printf ("Case %d:%lld\n", ca++, sum); } return 0;}
CSU 1507 Super Large LED display tenth session of Hunan Province game problem