记录编号 |
15524 |
评测结果 |
AWWWW |
题目名称 |
[NOI 1998]个人所得税 |
最终得分 |
20 |
用户昵称 |
EnAsn |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.012 s |
提交时间 |
2009-11-13 19:46:19 |
内存使用 |
4.69 MiB |
显示代码纯文本
program ex;
type
ss=array[1..50000,1..12]of real;
var
tax:ss;
n,i:longint;
sum:real;
procedure init;
var
s,s1:string;
num,mm:longint;
code,y:longint;
x:real;
begin
readln(s);
if s='#' then exit;
s1:=copy(s,1,pos(' ',s)-1);
delete(s,1,pos(' ',s));
while s[1]=' ' do delete(s,1,1);
if s1='PAY' then
begin
s1:=copy(s,1,pos(' ',s)-1);
delete(s,1,pos(' ',s));
while s[1]=' ' do delete(s,1,1);
val(s1,num,code);
s1:=copy(s,1,pos('/',s)-1);
val(s1,mm,code);
delete(s,1,pos(' ',s));
while s[1]=' ' do delete(s,1,1);
s1:=copy(s,1,length(s));
val(s1,x,code);
tax[num,mm]:=tax[num,mm]+x;
end
else
if s1='INCOME' then
begin
delete(s,1,pos(' ',s));
while s[1]=' ' do delete(s,1,1);
delete(s,1,pos(' ',s));
while s[1]=' ' do delete(s,1,1);
s1:=copy(s,pos(' ',s)+1,length(s));
val(s1,x,code);
if x<=4000 then x:=x-800 else x:=x*0.8;
if (x<=20000) then sum:=sum+x*0.2;
if (20000<x)and(x<=50000) then sum:=sum+4000+(x-20000)*0.3;
if (50000<x) then sum:=sum+13000+(x-50000)*0.4;
end;
end;
procedure print;
var
i,j:longint;
begin
for i:=1 to n do
for j:=1 to 12 do
if tax[i,j]<>0 then
begin
tax[i,j]:=tax[i,j]-800;
if tax[i,j]<=500 then sum:=sum+tax[i,j]*0.05;
if (500<tax[i,j])and(tax[i,j]<=2000) then sum:=sum+25+(tax[i,j]-500)*0.1;
if (2000<tax[i,j])and(tax[i,j]<=5000) then sum:=sum+175+(tax[i,j]-2000)*0.15;
if (5000<tax[i,j])and(tax[i,j]<=20000) then sum:=sum+625+(tax[i,j]-5000)*0.2;
if (20000<tax[i,j])and(tax[i,j]<=40000) then sum:=sum+3625+(tax[i,j]-20000)*0.25;
if (40000<tax[i,j])and(tax[i,j]<=60000) then sum:=sum+8625+(tax[i,j]-40000)*0.3;
if (60000<tax[i,j])and(tax[i,j]<=80000) then sum:=sum+14625+(tax[i,j]-60000)*0.35;
if (80000<tax[i,j])and(tax[i,j]<=100000) then sum:=sum+21625+(tax[i,j]-800000)*0.4;
if 100000<tax[i,j] then sum:=sum+101625+(tax[i,j]-100000)*0.45;
end;
writeln(sum:0:2);
end;
begin
assign(input,'personaltax.in');
assign(output,'personaltax.out');
reset(input);
rewrite(output);
readln(n);
while not eof do init;
print;
close(input);
close(output);
end.