Varianta 40 / Subiectul 3 / Problema 3 |
#include<fstream.h> ifstream f("bac.in"); void main() { int n,x,mpar=0,mimp=9999,ok=1,i; f>>n; for(i=1;i<=n;i++) { f>>x; if(x%2==0) if(x>=mpar) mpar=x; else ok=0; else if(x<=mimp) mimp=x; else ok=0; } if(ok) cout<<"da"; else cout<<"nu"; } |