Analysis:
Simulate the question and submit it for countless times. Pay attention to the following points:
1. If a person does not have a valid call record, the person's information will not be output. Here, the question is not displayed after 15 times of reading N times.
2. Call time money calculation: Suppose we calculate the bill between time1 and time2;
(1) We can start the calculation from the start point (that is, 00:00:00), and the result is get_money (time2)-get_money (time1), which is convenient for calculation.
(2) We can also start from time1 to time2, Which is annoying.
3. A valid call record indicates that if someone's call record is1.on;2.on;3.off;
, Where1.on
Will be discarded and matched2.on;3.off;
.
# Include <iostream> # include <stdio. h >#include <algorithm> # include <cstring> # include <vector> # include <cctype> # include <stack> # include <map> rate_structure [} person [cmp (Person &, person & (. name! =. Name <. total <get_money (idx) money = money + = person [idx]. dd ** rate_structure [(I =; I <person [idx]. hh; I ++ money ++ = * money + = person [idx]. mm * money/should_output (idx, n) pre =-(I = idx; I <n; I ++ (person [I]. name = (person [I]. is_on_line = pre = (person [I]. is_on_line = (pre! =-) Work (tmp = person [sum = pre =-; flag = (should_output (cout <person [printf (, person [flag = (I =; I <n; I ++ (person [I]. name! = (Flag = printf (flag = cout <printf (flag = pre =-sum = tmp = (person [I]. is_on_line = pre = (person [I]. is_on_line = (pre! =-Printf (, person [I]. total-money = get_money (I)-printf (sum + = pre =-(flag = printf (scanf (, & rate_structure [])! = Rate_structure [] = rate_structure []; (I =; I <; I ++ scanf (, & rate_structure [] + = scanf (, & (I =; I <n; I ++ cin> scanf (, & person [I]. month, & person [I]. hh, & cin> person [I]. total = person [I]. dd * + person [I]. hh * + person [I]. is_on_line = (status =?: Sort (person, person +}View Code