• POJ3913


    此题比较简单!!不多说!!



                                                                                            Gnome Sequencing
    Time Limit: 1000MS   Memory Limit: 65536K
    Total Submissions: 1526   Accepted: 1022

    Description

    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.

    Input

    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.

    Output

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

    Sample Input

    3
    40 62 77
    88 62 77
    91 33 18

    Sample Output

    Gnomes:
    Ordered
    Unordered
    Ordered

    Source

     
     
     
     
    1. #include <stdio.h>
    2. bool is_ordered(int a, int b, int c)
    3. {   
    4.   if (a < b && b < c)    
    5.      return true;   
    6.   if (a > b && b > c)      
    7.    return true;
    8.     return false;
    9. }
    10. int main()
    11. {   
    12.   int n, a, b, c;   
    13.   scanf("%d", &n);   
    14.   printf("Gnomes:\n");   
    15.   while (n--)    
    16. {        
    17. scanf("%d %d %d", &a, &b, &c);      
    18.    if (is_ordered(a, b, c))       
    19.       printf("Ordered\n");       
    20.   else            
    21. printf("Unordered\n");
    22.     }
    23.     return 0;
    24. }
     
  • 相关阅读:
    万字总结:学习MySQL优化原理,这一篇就够了!
    sql中自连接的使用
    SQL 优化原则
    Thumbnailator java图片压缩,加水印,批量生成缩略图
    java使用Thumbnailator处理图片
    Mysql优化原则_小表驱动大表IN和EXISTS的合理利用
    MySQL千万级多表关联SQL语句调优
    了解MySQL联表查询中的驱动表,优化查询,以小表驱动大表
    【explain】MySQL联表查询中的驱动表
    pyCharm最新2018激活码
  • 原文地址:https://www.cnblogs.com/Deng1185246160/p/2859488.html
Copyright © 2020-2023  润新知