Problem link—719A – Vitya in the Countryside
/*
Harun-or-Rashid
CSEDU-23rd Batch
*/
By coder_87, contest: Codeforces Round #373 (Div. 2), problem: (A) Vitya in the Countryside, Accepted, #
#include <bits/stdc++.h> using namespace std; int main() { int n,i; cin>>n; int a[n]; for(i=1; i<=n; i++) { cin>>a[i]; } if(n==1&&a[n]!=15&&a[n]!=0) cout<<-1<<endl; if(a[n]==15) { cout<<"DOWN"<<endl; } if(a[n]==0) { cout<<"UP"<<endl; } else { if(a[n]-a[n-1]==1&&a[n]!=15) { cout<<"UP"<<endl; } if(a[n]-a[n-1]==-1) { cout<<"DOWN"<<endl; } } return 0; }
Leave a Reply