poj3913 Gnome Sequencing
来源:互联网 发布:网络感叹号是什么原因 编辑:程序博客网 时间:2024/05/23 05:09
Gnome Sequencing
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2220 Accepted: 1517
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.
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
340 62 7788 62 7791 33 18
Sample Output
Gnomes:OrderedUnorderedOrdered
分析:输入三个数,判断是否为有序序列。
分析:数据很小,直接比较就行,注意输出是所有结果一起输出。
#include <iostream>#include <cstdio>#include <cstring>#include <stack>#include <queue>#include <map>#include <set>#include <vector>#include <cmath>#include <algorithm>using namespace std;const double eps = 1e-6;const double pi = acos(-1.0);const int INF = 0x3f3f3f3f;const int MOD = 1000000007;#define ll long long#define CL(a) memset(a,0,sizeof(a))int a,b,c,n,k;char s[33][11];bool flag;int main (){ cin>>n; k = 0; while (n--) { cin>>a>>b>>c; flag=false; if((a<=b&&b<=c)||(a>=b&&b>=c)) flag=true; if(flag) strcpy(s[k++], "Ordered"); else strcpy(s[k++], "Unordered"); } cout<<"Gnomes:"<<endl; for(int i=0; i<k; i++) cout<<s[i]<<endl; return 0;}
0 0
- poj3913 Gnome Sequencing
- 北大ACM poj3913 Gnome Sequencing
- 南邮 OJ 1088 Gnome Sequencing
- POJ 3913 Gnome Sequencing G++
- POJ 3913 Gnome Sequencing(水~)
- Bisulfite Sequencing
- Sequencing Problem
- DNA Sequencing
- gnome
- GNOME
- gnome
- 11942 - Lumberjack Sequencing
- UVa 11942 - Lumberjack Sequencing
- multi-format of sequencing
- uva 7529 - DNA Sequencing
- UVA 7529 - DNA Sequencing
- Java Persistence/Identity and Sequencing
- What comes after genome sequencing?
- leetcode 76 Minimum Window Substring
- MongoDB整合Spring 详细讲解(含代码)
- Xutils 框架
- 分治排序
- Unity AssetBundle资源打包,Depend依赖关系
- poj3913 Gnome Sequencing
- poj 2251 Dungeon Mastert题目
- Linux-Ubuntu 和 安装 genymotion 的一些问题和一些命令
- 【codevs1557】 热浪, Dijkstra算法入门
- 通过调用沙盒文件动态获取第三方字体库
- java提取域名函数
- 区分接口继承和实现继承(Effective C++_34)
- 01背包
- 数据结构(基本运算验证性实践路线)——顺序表