Cod sursa(job #21538)
| Utilizator | Data | 23 februarie 2007 20:09:46 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
var f,g:text; ok:boolean;
n,i,j,k,nr:integer;
begin
assign(f,'fractii.in'); reset(f);
assign(g,'fractii.out'); rewrite(g);
read(f,N);
for i:=1 to n do
for j:=1 to n do
begin
ok:=true;
if i=1 then inc(nr); if (j=1) and (i<>1) then inc(nr);
if (i<>1) and (j<>1) then
begin
for k:=2 to j do if (j mod k=0) and (i mod k=0) then ok:=false;
if ok then inc(nr);
end;
end;
write(g,nr);
close(g);
end.