记录编号 79423 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 Gravatar, 是否通过 通过
代码语言 Pascal 运行时间 0.014 s
提交时间 2013-11-05 17:50:34 内存使用 2.45 MiB
显示代码纯文本
program gmy(input,output);
var
 n,i,j,month,people,l,x,ll:longint;
 c,d:char;
 k:real;
 a:array[1..50000,1..12]of longint;
function geren(y:real):real;
begin
 if y<=20000 then exit(y*0.2);
 if y<=50000 then exit(4000+(y-20000)*0.3);
 exit(13000+(y-50000)*0.4);
end;
function yue(y:real):real;
begin
 if y<=500 then exit(y*0.05);
 if y<=2000 then exit(25+(y-500)*0.1);
 if y<=5000 then exit(175+(y-2000)*0.15);
 if y<=20000 then exit(625+(y-5000)*0.2);
 if y<=40000 then exit(3625+(y-20000)*0.25);
 if y<=60000 then exit(8625+(y-40000)*0.3);
 if y<=80000 then exit(14625+(y-60000)*0.35);
 if y<=100000 then exit(21625+(y-80000)*0.4);
 exit(29625+(y-100000)*0.45);
end;
begin
 assign(input,'personaltax.in');
 reset(input);
 assign(output,'personaltax.out');
 rewrite(output);
 readln(n);
 fillchar(a,sizeof(a),0);
 repeat
   read(c);
   if c='#' then break;
   if c='P' then begin
                  read(c); read(c);
                  people:=0;
                  ll:=0;
                  repeat
                    read(c);
                    if (c=' ') and (ll=1) then break;
                    if c<>' ' then begin
                                    people:=people*10+integer(c)-48;
                                    ll:=1;
                                   end;
                  until false;
                  month:=0;
                  repeat
                    read(c);
                    if (c<>' ') and (c<>'/') then month:=month*10+integer(c)-48;
                    if c='/' then break;
                  until false;
                  read(c); read(c);
                  readln(x);
                  a[people,month]:=a[people,month]+x;
                 end
            else begin
                  l:=0;
                  repeat
                    if c<>' ' then begin
                                    read(c);
                                    if c=' ' then l:=l+1;
                                   end
                              else read(c);
                  until l=3;
                  readln(x);
                  if (800<x) and (x<=4000) then k:=k+geren(x-800);
                  if (x>4000) then k:=k+geren(x*0.8);
                 end;
 until false;
 for i:=1 to n do
   for j:=1 to 12 do
     if a[i,j]>800 then k:=k+yue(a[i,j]-800);
 writeln(k:0:2);
 close(input);
 close(output);
end.