Advertisement
a53

sir13

a53
Jan 10th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream f("sir13.in");
  4. ofstream g("sir13.out");
  5. int a,b=-1,c=-1,ok;
  6.  
  7. int main()
  8. {
  9. while(f>>a&&ok==0)
  10. {
  11. if(a%2==0&&(b==-1||a>=b))
  12. b=a;
  13. else
  14. {
  15. if(a%2==1&&(c==-1||a<=c))
  16. {
  17. c=a;
  18. }
  19. else
  20. {
  21. if(a%2==0&&a<b)
  22. {
  23. ++ok;
  24. }
  25. else
  26. if(a%2==1&&a>c)
  27. {
  28. ++ok;
  29. }
  30. }
  31. }
  32. }
  33. f.close();
  34. if (ok == 0)
  35. g<<"DA";
  36. else
  37. g<<"NU";
  38. g.close();
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement