Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #define N 1001
- using namespace std;
- ifstream f("progresie3.in");
- ofstream g("progresie3.out");
- int F[N];
- int main()
- {
- int a;
- while(f>>a)
- F[a]=1;
- int r=0,ultim=-1;
- bool ok=true;
- for(int i=0;i<N&&ok;++i)
- if(F[i])
- {
- if(ultim!=-1)
- {
- if(r==0)
- r=i-ultim;
- else
- if(i-ultim!=r)
- ok=false;
- }
- ultim=i;
- }
- if(ok)
- g<<r;
- else
- g<<"NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement