zoukankan      html  css  js  c++  java
  • 1088-Gnome Sequencing

    描述

    In the book All Creatures of Mythology, gnomes are kind, bearded creatures, while goblins tend to be bossy and simple-minded. The goblins like to harass the gnomes by making them line up in groups of three, ordered by the length of their beards. The gnomes, being of different physical heights, vary their arrangements to confuse the goblins. Therefore, the goblins must actually measure the beards in centimeters to see if everyone is lined up in order. Your task is to write a program to assist the goblins in determining whether or not the gnomes are lined up properly, either from shortest to longest beard or from longest to shortest.

    输入

    The input starts with line containing a single integer N, 0 < N < 30, which is the number of groups to process. Following this are N lines, each containing three distinct positive integers less than 100.

    输出

    There is a title line, then one line per set of beard lengths. See the sample output for capitalization and punctuation.

    样例输入

    3

    40 62 77

    88 62 77

    91 33 18

    样例输出

    Gnomes:

    Ordered

    Unordered

    Ordered

    #include<iostream>
    using namespace std;
    int main()
    {
        int n,a,b,c;
        cin>>n;
        cout<<"Gnomes:"<<endl;
        while(n--)
        {        
            cin>>a>>b>>c;
            if((a-b)*(b-c)<0) cout<<"Unordered"<<endl;
            else cout<<"Ordered"<<endl;
        }
        return 0;
    } 
    

      

  • 相关阅读:
    向量空间模型 词袋模型
    python 小点
    python list的append()和extend()方法
    numpy 数组运算
    内置函数和numpy中的min(),max()函数
    python index()函数
    Python支持的正则表达式元字符和语法
    Python多线程
    查看linux机器配置&内核版本
    Shell获取文件的文件名和扩展名的例子
  • 原文地址:https://www.cnblogs.com/Rosanna/p/3436864.html
Copyright © 2011-2022 走看看