Advertisement
rotti321

BAC 2016 SIII Ex .4

Mar 14th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream fin("date.in");
  6.  
  7. int main()
  8. {
  9.     int x,p1=-1,p2=-1,i1=-1,i2=-1,ok=1;
  10.     while(fin>>x){
  11.         if(x%2==0){
  12.          if(p1==-1){
  13.             p1=x;
  14.             p2=x;
  15.          }
  16.          else{
  17.                 p1=p2;
  18.                 p2=x;
  19.             if(p1<=p2)
  20.             {
  21.                ok=0;
  22.             }
  23.          }
  24.         }
  25.         else
  26.         {
  27.             if(i1==-1)
  28.             {
  29.                 i1=x;
  30.                 i2=x;
  31.             }
  32.             else
  33.             {
  34.                 i1=i2;
  35.                 i2=x;
  36.                 if(i1>=i2)
  37.                 {
  38.                    ok=0;
  39.                 }
  40.             }
  41.         }
  42.     }
  43.      /// (ok==1)? cout<<"DA": cout<<"NU";
  44.      if(ok==1){
  45.         cout<<"DA";
  46.        
  47.      }
  48.      else
  49.      {
  50.          cout<<"NU";
  51.      }
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement