http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1507
1507: Extra Large LED display time limit: 1 Sec memory limit: MB submitted: 124 Resolution: 61 [Submit] [status] [discussion] Title Description
Input
The input contains no more than 100 sets of data. The first behavior of each set of data is "start Hh:mm:ss", indicating that the start of the game is hh:mm:ss. The last act, "End Hh:mm:ss", is the end of the game. There will be at least one score message in the format "score Hh:mm:ss team Score", where team is either "home" (home) or "guest" (away), score means score, or 3. This information is guaranteed to be arranged in the order of time from morning to night, and any two score information will be different at all times. The start time of the game will not be earlier than 9:00 and the end time will not be later than 21:00 of the same day. Note that if the tournament start time is 09:00:00 and the end time is 09:00:01, the match length is 1 seconds instead of 2 seconds.
Output
For each set of data, output the test point number and total power consumption.
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 Hom E 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:478,800
Hint Source
The tenth session of Hunan Province College students computer Program design Contest
Analysis:
Simulate every second directly from the start time, increasing the power consumption as long as there is a team score until the end.
Official Standard Range:
1 //Rujia Liu2#include <cstdio>3#include <iostream>4#include <string>5#include <cassert>6 using namespacestd;7 8 intScore1, score2, ans;9 Ten Const intNum[] = {6,2,5,5,4,5,6,3,7,6}; One A intS2T (Const string&s) { - inthh, MM, SS; -SSCANF (S.c_str (),"%d:%d:%d", &hh, &MM, &ss); theASSERT (hh>=9&& hh<= +&& mm>=0&& mm<= -&& ss>=0&& ss<= -); - intAns = hh *3600+ mm * -+SS; -ASSERT (ans>=9*3600&& ans<= +*3600); - returnans; + } - + voidAccumulate (intScore,intDT) { A Charn[ About]; atsprintf (N,"%d", score); - for(inti =0; I < strlen (n); i++) -Ans + = dt * Num[n[i]-'0']; - } - - intMain () { in intKase =0, score; - strings, S2, team; to while(Cin >> S >>S2) { +Score1 = Score2 = ans =0; -ASSERT (S = ="START"); the intlast_t =s2t (S2); * while(Cin >> S >>S2) { $ intt =s2t (S2);Panax NotoginsengASSERT (T >last_t); -Accumulate (Score1, T-last_t); theAccumulate (Score2, T-last_t); +last_t =T; A if(s = ="END") Break; theASSERT (S = ="score"); + -CIN >> Team >>score; $ASSERT (score>=1&& score<=3); $ if(Team = ="Home") Score1 + =score; - Else if(Team = ="Guest") Score2 + =score; - ElseAssert0); the } -cout <<" Case"<< ++kase <<": "<< ans <<"\ n";Wuyi } the return 0; -}View Code
Csuoj 1507: Ultra-Large LED display