0%

NOIP 2004 津津的储蓄计划

可以说超简单的一道题,学过数组的人都应会做

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
program save;
var a:array[0..12]of integer;
i,x,p:integer;
begin
assign(input,'save.in');reset(input);
assign(output,'');rewrite(output);
for i:=1 to 12 do a[i]:=300;
a[0]:=0;p:=0;
for i:=1 to 12 do begin
readln(x);inc(a[i],a[i-1]);dec(a[i],x);
if a[i]<0 then begin
writeln('-',i);
close(input);close(output);exit;
end else {if a[i]>=100 then} begin
p:=(a[i]div 100)*100;
inc(a[0],p);
a[i]:=a[i]-p;
end;
end;
a[0]:=a[0]*6 div 5;
writeln(a[0]+a[12]);
close(input);close(output);
end.

Welcome to my other publishing channels