Advertisement
artur99

Untitled

Apr 29th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include<iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, v[1009],k=-1 ;
  8.     cin>>n;
  9.     for (int i=1; i<=n; i++)
  10.         cin>>v[i];
  11.     int i=1;
  12.     while (i<n && v[i]==v[i+1])i++;
  13.     if (i==n) k=0;
  14.     else{
  15.     i=1;
  16.     while (i<n && v[i]<=v[i+1])i++;
  17.     if (i==n) k=3;
  18.  
  19.     i=1;
  20.     while (i<n && v[i]>=v[i+1])i++;
  21.     if (i==n) k=4;
  22.    
  23.     i=1;
  24.     if(k==3||k==4){
  25.         int kk=0;
  26.         while (i<n){if(v[i]==v[i+1])kk++;i++;}
  27.         if(kk){if(k==3)k=1;else k=2;}
  28.     }
  29.     }
  30.  
  31.  
  32.     switch (k) {
  33.         case 0: cout<<"sir constant"; break;
  34.         case 1: cout<<"sir crescator"; break;
  35.         case 2: cout<<"sir descrescator"; break;
  36.         case 3: cout<<"sir strict crescator"; break;
  37.         case 4: cout<<"sir strict descrescator"; break;
  38.         default: cout<<"sir neordonat";
  39.     }
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement