Saleh127

UVA 11063

Sep 12th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6. ll b[1001] = {0},n,t=0,i,j;
  7. while(scanf("%lld",&n)==1)
  8. {
  9.  
  10. ll f=0;
  11. for(i = 1; i <= n; i++)
  12. {
  13. scanf("%lld",&b[i]);
  14. if(b[i]<=b[i-1])
  15. {
  16. f=1;
  17. }
  18. }
  19.  
  20. ll m[20001]={0};
  21.  
  22. if(f==0)
  23. {
  24. for(i = 1; i <= n; i++)
  25. {
  26. for(j = i; j <= n; j++)
  27. {
  28. if(m[b[i]+b[j]] != 0)
  29. {
  30. f=1;
  31. break;
  32. }
  33. m[b[i]+b[j]] = 1;
  34. }
  35. }
  36. }
  37.  
  38. printf("Case #%lld: It is ", ++t);
  39.  
  40. if(!f) printf("a B2-Sequence.\n");
  41. else printf("not a B2-Sequence.\n");
  42.  
  43. printf("\n");
  44. }
  45. return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment