CF 254B(日期)

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
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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值