记录编号 15369 评测结果 AAAAA
题目名称 [NOI 1998]个人所得税 最终得分 100
用户昵称 Gravatar王瑞祥K 是否通过 通过
代码语言 Pascal 运行时间 0.061 s
提交时间 2009-11-12 16:13:20 内存使用 4.69 MiB
显示代码纯文本
program personaltax(input,output);
var
 a:array[1..50000,1..12]of int64;
 tot,paytax,incometax,icm:double;
 st,zh,md:ansistring;
 i,j,per,mon,pain,m,p,code,income:longint;
 pay:int64;
begin
 assign(input,'personaltax.in');assign(output,'personaltax.out');
 reset(input);rewrite(output);
 readln(m);
 tot:=0;
 fillchar(a,sizeof(a),0);
 readln(st);
 while st<>'#' do begin
  p:=pos(' ',st);
  md:=copy(st,1,p-1);
  delete(st,1,p);
  while st[1]=' ' do delete(st,1,1);
  p:=pos(' ',st);
  zh:=copy(st,1,p-1);
  val(zh,per,code);
  delete(st,1,p);
  while st[1]=' ' do delete(st,1,1);
  p:=pos('/',st);
  zh:=copy(st,1,p-1);
  val(zh,mon,code);
  p:=pos(' ',st);
  delete(st,1,p);
  while st[1]=' ' do delete(st,1,1);
  val(st,pain,code);
  if md='PAY' then a[per,mon]:=a[per,mon]+pain;
  if md='INCOME' then begin
   income:=pain;
   incometax:=0;
   if income>800 then begin
    if income<=4000 then icm:=income-800 else icm:=income*0.8;
    if icm<=20000 then incometax:=icm*0.2;
    if (icm>20000)and(icm<=50000) then incometax:=(icm-20000)*0.3+4000;
    if icm>50000 then incometax:=(icm-50000)*0.4+13000;
   end;
   tot:=tot+incometax;
  end;
  readln(st);
 end;
 for i:=1 to m do
  for j:=1 to 12 do begin
   pay:=a[i,j];
   paytax:=0;
   if pay>800 then begin
    pay:=pay-800;
    case pay of
     1..500:paytax:=pay*0.05;
     501..2000:paytax:=(pay-500)*0.1+25;
     2001..5000:paytax:=(pay-2000)*0.15+175;
     5001..20000:paytax:=(pay-5000)*0.2+625;
     20001..40000:paytax:=(pay-20000)*0.25+3625;
     40001..60000:paytax:=(pay-40000)*0.3+8625;
     60001..80000:paytax:=(pay-60000)*0.35+14625;
     80001..100000:paytax:=(pay-80000)*0.4+21625;
    end;
    if pay>100000 then paytax:=(pay-100000)*0.45+29625;
   end;
   tot:=tot+paytax;
  end;
 writeln(tot:0:2);
 close(input);close(output);
end.