Cod sursa(job #605224)
| Utilizator | Data | 27 iulie 2011 11:00:13 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
program Fractii;
var t:text;p,q,c,n,a,b:integer;
begin
assign(t,'fractii.in');
reset(t);
read(t,n);
c := 0;
for p := 1 to n do
for q := 1 to n do
begin
a := p;
b := q;
while a <> b do
begin
if a > b then a := a - b;
if b > a then b := b - a;
end;
if a = 1 then c := c + 1;
end;
assign(t,'fractii.out');
rewrite(t);
write(t,c);
end.
