- 津津的储蓄计划
- 2016-10-10 21:20:15 @
var i,k,s,x,v:integer;a:array[1..13]of integer;
begin
for i:=1 to 12 do
read(a[i]);i:=0;k:=1;
while i<>12 do
begin
inc(i);
x:=300-a[i]+s;if x<0 then k:=0-i;
s:=s+x;
if s>=100 then begin s:=s-100;v:=v+100;end;
if s>=100 then begin s:=s-100;v:=v+100;end;
if s>=100 then begin s:=s-100;v:=v+100;end;
end;
if k<0 then writeln(k);
if k=1 then writeln(v*1.2+x);
end.
1 条评论
-
hahayang LV 10 @ 2016-11-13 15:53:25
var
a:array[0..12] of longint;
i:longint;
max:real;
procedure jinjin;
begin
a[i]:=a[i-1]+300-a[i];
if a[i]>=0 then begin
max:=max+(a[i] div 100)*100;
a[i]:=a[i]-(a[i] div 100)*100
end
else begin write(-i);
halt
end;
end;
begin
for i:=1 to 12 do readln(a[i]);
a[0]:=0;
for i:=1 to 12 do jinjin;
write(trunc(max/5*6)+a[12]);
end.
- 1