CF 254B(日期)

来源:互联网 发布:搜索引擎优化bwysj 编辑:程序博客网 时间:2024/05/16 19:14
B. 评委会
time limit per test
1 second
memory limit per test
256 megabytes
input
input.txt
output
output.txt

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

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

Input

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

非润年,二月28天. 可能需要在2012年某天开始准备.

Output

输出最小人数。

Sample test(s)
input
25 23 1 23 13 2 3
output
2
input
312 9 2 112 8 1 312 8 2 2
output
3
input
11 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.


原创粉丝点击