Cod sursa(job #180500)
Utilizator | alex dominte alex.dominte | Data | 17 aprilie 2008 09:24:47 |
---|---|---|---|
Problema | Curcubeu | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <fstream.h>
long h[100000];
ifstream fin ("curcubeu.in");
ofstream fout ("curcubeu.out");
int main ()
{
int i,pas;
long n,a,b,c;
fin>>n>>a>>b>>c;
if (a<=b)
for (i=a;i<=b;i++) h[i]=c;
else for (i=b;i<=a;i++) h[i]=c;
pas=2;
while (pas!=n)
{
a=(a*pas)%n;
b=(b*pas)%n;
c=(c*pas)%n;
if (a<=b)
for (i=a;i<=b;i++) h[i]=c;
else for (i=b;i<=a;i++) h[i]=c;
pas++;
}
for (i=1;i<n;i++)
fout<<h[i]<<'\n';
return 0;
}