BEEHIVE.INP | BEEHIVE.OUT |
4 | 37 |
SNAIL.INP | SNAIL.OUT |
2 1 5 | 4 |
tổ ong
var S,N:int64;
f:text;
Begin
assign(f,'BEEHIVE.INP');
reset(f);
readln(f,N);
close(f);
if N=1 then S:=1
else S:=1+6*((N-1)*N div 2);
assign(f,'BEEHIVE.OUT');
rewrite(f);
writeln(f,S);
close(f);
end.
ốc sên
uses crt;
const
fi='SNAIL.INP';
fo='SNAIL.OUT';
Var a,b,v,x:longint;
f:text;
Begin
clrscr;
assign(f,fi);reset(f);
readln(f,a,b,v);
close(f);
x:=(V-a)div(a-b)+1;
if (V-a)mod(a-b)<>0 then inc(x);
assign(f,fo);rewrite(f);
writeln(f,x);
close(f);
end.
trên là 1 cách giải xin mọi người cho cách khác