Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
贴代码……#include<iostream> using namespace std; int n,a[3]; bool isUp(int a[],int n) { for(int i=1;n-i>0;i++) { if(a[i]<a[i-1]) return false; } return true; } bool isDown(int a[],int n) { for(int i=1;n-i>0;i++) { if(a[i]>a[i-1]) return false; } return true; } int main() { cin>>n; cout<<"Gnomes:"<<endl; for(int i=0;n-i>0;i++) { cin>>a[0]>>a[1]>>a[2]; if(isUp(a,3)||isDown(a,3)) cout<<"Ordered"<<endl; else cout<<"Unordered"<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator