Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴代码……

Posted by speedcell4 at 2011-06-20 21:10:23 on Problem 3913
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator