
谁能帮忙解一道c语言题啊 高分
Anascendingsortedsequenceofdistinctvaluesisoneinwhichsomeformofaless-thanoperatorisus...
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A < B, B < C and C < D. in this problem, we will give you a set of relations of the form A < B and ask you to determine whether a sorted order has been specified or not.
【Input】
Input consists of multiple problem instances. Each instance starts with a line containing two positive integers n and m. the first value indicated the number of objects to sort, where 2 <= n <= 26. The objects to be sorted will be the first n characters of the uppercase alphabet. The second value m indicates the number of relations of the form A < B which will be given in this problem instance. 1 <= m <= 100. Next will be m lines, each containing one such relation consisting of three characters: an uppercase letter, the character "<" and a second uppercase letter. No letter will be outside the range of the first n letters of the alphabet. Values of n = m = 0 indicate end of input.
【Output】
For each problem instance, output consists of one line. This line should be one of the following three:
Sorted sequence determined: y y y… y.
Sorted sequence cannot be determined.
Inconsistency found.
y y y… y is the sorted, ascending sequence.
Sample Input
4 6
A<B
A<C
B<C
C<D
B<D
A<B
3 2
A<B
B<A
26 2
A<Z
D<S
0 0
Sample Output
Sorted sequence determined: A B C D.
Inconsistency found.
Sorted sequence cannot be determined.
哈哈。我也看不懂啊 .
大哥,怎么不给答案呢?
谁给出答案我就把分给谁 展开
【Input】
Input consists of multiple problem instances. Each instance starts with a line containing two positive integers n and m. the first value indicated the number of objects to sort, where 2 <= n <= 26. The objects to be sorted will be the first n characters of the uppercase alphabet. The second value m indicates the number of relations of the form A < B which will be given in this problem instance. 1 <= m <= 100. Next will be m lines, each containing one such relation consisting of three characters: an uppercase letter, the character "<" and a second uppercase letter. No letter will be outside the range of the first n letters of the alphabet. Values of n = m = 0 indicate end of input.
【Output】
For each problem instance, output consists of one line. This line should be one of the following three:
Sorted sequence determined: y y y… y.
Sorted sequence cannot be determined.
Inconsistency found.
y y y… y is the sorted, ascending sequence.
Sample Input
4 6
A<B
A<C
B<C
C<D
B<D
A<B
3 2
A<B
B<A
26 2
A<Z
D<S
0 0
Sample Output
Sorted sequence determined: A B C D.
Inconsistency found.
Sorted sequence cannot be determined.
哈哈。我也看不懂啊 .
大哥,怎么不给答案呢?
谁给出答案我就把分给谁 展开
展开全部
题目的意思是:
1.给你 一组数.这组数共有n 个. (2<=n<=26,即至少两个最多26个,这样的话只需要用26个大写字母就可以表示出来).
2.然后再给你 这组数里面 的 数之间的关系,(此处只有小于关系.比如说
A<B 代表第一个数比第二个数小.
E<D 表示 第五个数 比 第四个数小.
3. n 代表的是总共多少个数,m 的意思是接下来要输入多少个限制条件(也就是多少组数之间的大小关系,但此处只要求小于关系)
4.要解决的问题是: 判断 符合上述 条件的 这组数.到底是不是按升序排列的.
5.输入格式: 见上面的 input 之后的字符.
6.输出格式:
Sorted sequence determined: A B C D.
Inconsistency found.
Sorted sequence cannot be determined.
1.给你 一组数.这组数共有n 个. (2<=n<=26,即至少两个最多26个,这样的话只需要用26个大写字母就可以表示出来).
2.然后再给你 这组数里面 的 数之间的关系,(此处只有小于关系.比如说
A<B 代表第一个数比第二个数小.
E<D 表示 第五个数 比 第四个数小.
3. n 代表的是总共多少个数,m 的意思是接下来要输入多少个限制条件(也就是多少组数之间的大小关系,但此处只要求小于关系)
4.要解决的问题是: 判断 符合上述 条件的 这组数.到底是不是按升序排列的.
5.输入格式: 见上面的 input 之后的字符.
6.输出格式:
Sorted sequence determined: A B C D.
Inconsistency found.
Sorted sequence cannot be determined.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
翻译后都没有看懂
麻烦兄弟给中文好吧
或者你直接说干什么就行了吧
还这么麻烦
麻烦兄弟给中文好吧
或者你直接说干什么就行了吧
还这么麻烦
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
天呢,看懂都有点困难呢,更不用说还要搞明白了,哈哈
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我资料里有联系方式
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询