直接模拟,注意日期换算。
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.