Cod sursa(job #448339)
| Utilizator | Data | 3 mai 2010 15:40:48 | |
|---|---|---|---|
| Problema | Reguli | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<fstream>
using namespace std;
# define nmax 500002
long long P[nmax],n,L[nmax];
void citire()
{
ifstream f("reguli.in");
f>>n;long long i;f>>L[0];
for(i=1;i<n;i++) { f>>L[i];P[i]=L[i]-L[i-1];}
}
int main()
{
ofstream g("reguli.out");
citire();
long long max=1,i,q;
for(i=1;i<n;i++)
{
q=i%max;
if(q!=0&&P[q]!=P[i]) max=i;
if(q==0&&P[max]!=P[i]) max=i;
}
g<<max<<'\n';
for(i=1;i<=max;i++)
g<<P[i]<<'\n';
}