寻找序列中的推断的数字,采用C程序的语言的程序设计的方式怎么做的

Problem Description
  Hunan TV holds many talent shows every year, such as Happy Girls and Super Boys which attract the attention of the whole country. This year Hunan University held a new type of talent show called Brilliant Programmers. Millions of programmers had registered online and only top N most brilliant programmers got the opportunity to compete on site. The organizer had hold ten rounds of qualification contest and programmers were ranked by their total scores. The programmers who ranked after N were eliminated.
  The final show continued for a very long time. Initially programmers were ranked by their qualification scores. The rule was special: A challenge may be happen between exactly two adjacent ranked programmers at any time and the lower ranked one tries to solve the other’s problem. If the challenger successfully solves this problem, their ranks exchange. Otherwise their ranks remain unchanged. It is guaranteed that a programmer never involved in two challenges at the same time. The top ranked programmer at last is the champion.
  The show was over but… The hard disk which logs the whole progress was burned out. After data rescue, the number of successful challenges of each programmer was recovered but the final rank was disappeared forever. During the rescue some errors may occur, which lead to some wrong recovered numbers. Is the show possible at all? If it is possible, can you help to find the champion from the very limited information?

Input
  There are multiple test cases.
  Each test case is described in two lines. The first line contains one integer N: the number of programmers. The second line contains a sequence of integers Ai that gives the number of successful challenges of the programmer initially ranked i-th.
1 <= N <= 106, 0 <= Ai <= 109
  The input will finish with the end of file.

Output
  For each case the output contains only one line.
  If it is an impossible show, output “Bad Rescue”. Otherwise if the champion is uniquely determined, output the initial rank of the champion. Output “Unknown” if the champion is not sure.

Sample Input
2
0 1
3
0 1 5
3
0 1 1

Sample Output
2
Bad Rescue
Unknown

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

2
C++语言编程 单调递增最长子序列
13
c语言编译的最大子序列求和问题
2
给一个整数x将该数插入到序列中,并使新的序列仍然有序,如何C语言
0
C程序输出题目所要求的序列,序列中每个元素一行。如果存在两个符合要求的序列
0
计算第k大的数字,在序列中,采用一次遍历的算法,C语言
0
给一个整数x,请将该数插入到序列中,并使新的序列仍然有序,使用C语言怎么实现的计算
0
查找最大的非递减的序列的一个算法的问题采用C语言进行解答
0
寻找非递减的子序列的一个算法问题,采用C语言的技术实现的方式是?
0
单增长序列数字上找最大值的一个问题的算法,用C语言的办法实现
0
KMP序列匹配算法的一个实现原理问题,采用C语言方式的编程计算
0
行列式绝对值数字序列的问题求值,运用C语言算法编程的技术
2
c# 有点复杂的XML报文反序列化
0
算法问题序列期望权值是多少,用C语言的程序设计怎么求?
2
以实际数量求平均值。编程输出该平均值序列,采用C语言编程实现
0
寻找集合的非递减序列的算法,怎么利用C语言程序的设计办法来实现的
0
最大的二进制子序列的查找算法,运用C语言的程序的设计的原理实现
0
最短的重复子序列的寻找问题的算法,怎么使用C语言程序的设计来实现代码
0
序列上截取一个最大的和的连续数列的问题,怎么采用C程序的语言设计的办法
0
请问这个程序用c怎么写?什么时候输出的序列不是单调递增?
2
使用phtread多线程编程程序来生成Fibonacci序列 c/c++