Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<fstream>
- using namespace std;
- ifstream fin("bac.txt");
- int v[1001];
- int main()
- {int x,ok=1,r=-1,i,p;
- while(fin>>x)
- v[x]=1;
- i=0;
- while(v[i]==0)
- i++;
- p=i;
- for(i=i+1;i<=1000;i++)
- {if(v[i]==1)
- {
- if(r<0)
- r=i-p;
- else
- if(i-p!=r)
- ok=0;
- p=i;}
- }
- if(ok)
- cout<<"Ratie= "<<r;
- else
- cout<<"NU";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement