首页 > 其他分享 >CF 254B(日期)

CF 254B(日期)

时间:2022-10-25 11:07:21浏览次数:45  
标签:do 12 31 30 CF 254B 日期 input output


B. 评委会



time limit per test



memory limit per test



input



output



n 场比赛,编号1 到 n. 每场比赛需要人准备(在开幕的前 ti 天(不包括开幕当天))

如果准备时间重复,一个人一天只能为一场比赛准备,请问最少需要雇多少人准备?



Input



n  (1 ≤ n ≤ 100). 接下来 n 行每行为midipi 和 ti — 开幕的月份,日期,每天需要的人数,准备天数 (1 ≤ mi ≤ 12, di ≥ 1, 1 ≤ pi, ti ≤ 100),输入顺序任意,一天可能有同时多场比赛开幕。

可能需要在2012年某天开始准备.



Output



输出最小人数。



Sample test(s)



input



2 5 23 1 2 3 13 2 3



output



2



input



3 12 9 2 1 12 8 1 3 12 8 2 2



output



3



input



1 1 10 1 13



output



1



直接模拟,注意日期换算。



Program jury;
var
n,i,j,m,d,p,t,ans:longint;
month:array[1..12] of longint=(31,28,31,30,31,30,31,31,30,31,30,31);
a:array[-1000..1000] of longint;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
read(n);
fillchar(a,sizeof(a),0);
for i:=1 to n do
begin
read(m,d,p,t);
for j:=1 to m-1 do inc(d,month[j]);
for j:=d-1 downto d-t do
inc(a[j],p);
end;
ans:=0;
for i:=-1000 to 1000 do
if ans<a[i] then ans:=a[i];
writeln(ans);

close(input);
close(output);
end.



标签:do,12,31,30,CF,254B,日期,input,output
From: https://blog.51cto.com/u_15724837/5794137

相关文章