Cod sursa(job #763935)

Utilizator andrei_toaderToader Andrei Sorin andrei_toader Data 3 iulie 2012 15:54:40
Problema Curcubeu Scor 20
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
program curvcube;
var f,g:text;
    n,ai,bi,ci,min,max,j,i:longint;
    v:array [1..1000000] of longint;

begin
 assign (f,'curcubeu.in'); reset (F);
 assign (g,'curcubeu.out'); rewrite (g);
 read (f,n,ai,bi,ci);
 if ai<bi then
 begin
  min:=ai; max:=bi;
 end
 else
 begin
  min:=bi; max:=ai;
 end;
 for i:=min to max do
  v[i]:=ci;
 for i:=2 to n-1 do
 begin
  ai:=(ai*i) mod n;
  bi:=(bi*i) mod n;
  ci:=(ci*i) mod n;
   if ai<bi then
 begin
  min:=ai; max:=bi;
 end
 else
 begin
  min:=bi; max:=ai;
 end;
 for j:=min to max do
  v[j]:=ci;
 end;
 for i:=1 to n-1 do
  writeln (g,v[i]);
 close (f); close (G);
end.