P1422 小玉家的电费 代码:
总:分类(累)讨论。
var
n:longint;
ans:real;
begin
readln(n);
if n<=150 then ans:=n*0.4463;
if (n>150) and (n<=400) then ans:=150*0.4463+(n-150)*0.4663;
if n>400 then ans:=150*0.4463+250*0.4663+(n-400)*0.5663;
write(ans:0:1);
end.
P1085 不高兴的津津 代码:
总:根据题意判断。
var
a,b,i,s,t:longint;
begin
s:=0;
for i:=1 to 7 do
begin
readln(a,b);
if a+b>s then begin s:=a+b; t:=i; end;
end;
write(t);
end.
P1089 津津的储蓄计划
总:根据题意做。
var
i,s,n,t:longint;
a:array [1..50] of longint;
begin
for i:=1 to 12 do
readln(a[i]);
s:=0; t:=0;
for i:=1 to 12 do
begin
s:=s+300-a[i];
t:=t+s div 100;
s:=s mod 100;
if s<0 then
begin
write('-',i);
exit;
end;
end;
write(t*120+s);
end.
总结:
判断+模拟。