码迷,mamicode.com
首页 > 其他好文 > 详细

POJ3913 UVALive4571 Gnome Sequencing【水题】

时间:2019-01-09 11:35:09      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:tle   integer   gem   cin   RoCE   range   desc   poj   printf   

Gnome Sequencing
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 2791 Accepted: 1808

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

Mid-Central USA 2009

问题链接POJ3913 UVALive4571 Gnome Sequencing
问题简述:(略)
问题分析
????给三个数,判定是否有序。用条件表达式来写代码比较简单。这个水题也就能看个程序是否写得简洁。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C语言程序如下:

/* POJ3913 UVALive4571 Gnome Sequencing */

#include <stdio.h>

int main(void)
{
    int n, a, b, c;
    scanf("%d", &n);
    puts("Gnomes:");
    while(n--) {
        scanf("%d%d%d", &a, &b, &c);
        printf("%s\n", (a >= b && b >= c) || (a <= b && b <=c) ? "Ordered" : "Unordered");
    }

    return 0;
}

POJ3913 UVALive4571 Gnome Sequencing【水题】

标签:tle   integer   gem   cin   RoCE   range   desc   poj   printf   

原文地址:https://www.cnblogs.com/tigerisland45/p/10242331.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!