Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- long long n ,x=0 ;
- int c,c2,t=1,cnt;
- while(cin>>n)
- {
- cnt=0 ;
- x=n*(n+1) ;
- x/=2 ;
- long long arr[n] ,sum[x];
- c=0 ,c2=0;
- for (int i=0 ; i<n ; i++)
- {
- cin>>arr[i] ;
- }
- c=*arr<1;
- for (int i=0 ; i<n-1 ; i++)
- {
- if (arr[i+1]<=arr[i])
- {
- c=1 ;
- }
- }
- for (int i=0 ; i<n ; i++)
- {
- for (int j=i ; j<n ; j++)
- {
- sum[cnt]=arr[i]+arr[j] ;
- if (cnt<x)
- {
- cnt++ ;
- }
- }
- }
- for (int i=0 ;i<x ;i++)
- {
- for (int j=0 ;j<x ;j++)
- {
- if (sum[i]==sum[j] && i!=j )
- {
- c2=1 ;
- }
- }
- }
- if (c==1 || c2==1)
- {
- cout<<"Case #"<<t<<": It is not a B2-Sequence."<<endl<<endl ;
- }
- else
- {
- cout<<"Case #"<<t<<": It is a B2-Sequence."<<endl<<endl ;
- }
- t++ ;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment