Solution - UVa Problem 11942 - Lumberjack Sequencing



আলোচনাঃ
Problem Link Here.

সল্যুশন্সঃ
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin >> t;
    for(int i=1; i<=t; i++){
        bool aord = false;
        bool fl = false;
        int nm[10];
        for(int j=0; j<=9; j++){
            cin >> nm[j];
            int k = j;
            if(k>1){
                if(nm[j]>=nm[j-1] && nm[j-1]>=nm[j-2]) aord = true;
                else if(nm[j]<=nm[j-1] && nm[j-1]<=nm[j-2]) aord = true;
                else aord = false;
                if(aord == false) fl = true;
            }
        }
        if(i==1) cout << "Lumberjacks:" << endl;
        if(fl==true) cout << "Unordered" << endl;
        else cout << "Ordered" << endl;
    }
    return 0;
}

Comments

Popular posts from this blog

Solution - Timus Problem 1293. Eniya

Solution - Codeforces Problem 327B - Hungry Sequence

Solution - Timus Problem 1409. Two Gangsters