Nu aveti permisiuni pentru a descarca fisierul grader_test6.in
Cod sursa(job #20233)
| Utilizator | Data | 20 februarie 2007 21:14:39 | |
|---|---|---|---|
| Problema | Calcul | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.69 kb |
program calcul;
var i,s,j,c,r,p,g,a,h:longint;
b:string;
y,u:text;
begin
assign(y,'calcul.in');
reset(y);
readln(y,a);
readln(y,b);
readln(y,c);
close(y);
if b='1' then h:=1;
if b='2' then h:=2;
if b='3' then h:=3;
if b='4' then h:=4;
if b='5' then h:=5;
if b='6' then h:=6;
if b='7' then h:=7;
if b='8' then h:=8;
if b='9' then h:=9;
if b='A' then h:=10;
if b='B' then h:=11;
if b='C' then h:=12;
if b='D' then h:=13;
if b='E' then h:=14;
if b='F' then h:=15;
s:=0;
for i:=1 to h do begin
p:=1;
for j:=1 to i do begin
p:=p*a;
end;
s:=s+p;
end;
g:=1;
for i:=1 to c do
g:=g*10;
r:=s mod g;
assign(u,'calcul.out');
rewrite(u);
write(u,r);
close(u);
end.
