Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int n,a[100000],sum[100000],b,c,i,j,k,l=0,flag=0;
- while(scanf("%lld",&n)!=EOF)
- {
- l++;
- flag=0;
- for(i=0;i<n;i++)
- cin>>a[i];
- cout<<"Case #"<<l<<": ";
- if(a[0]<1){
- cout<<"It is not a B2-Sequence."<<endl;
- cout<<endl;
- continue;
- }
- for(i=1;i<n;i++)
- {
- if(a[i]<=a[i-1])
- {
- flag=1;
- break;
- }
- }
- if(flag==1)
- {
- cout<<"It is not a B2-Sequence."<<endl;
- cout<<endl;
- continue;
- }
- flag=0;
- k=0;
- for(i=0;i<n;i++)
- {
- for(j=i;j<n;j++)
- {
- sum[k++]=a[i]+a[j];
- }
- }
- for(i=0;i<k;i++)
- {
- for(j=i+1;j<k;j++)
- {
- if(sum[i]==sum[j])
- {
- flag=1;
- break;
- }
- }
- }
- if(flag==1)
- cout<<"It is not a B2-Sequence."<<endl;
- else
- cout<<"It is a B2-Sequence."<<endl;
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement