The hardest problem

来源:互联网 发布:js中get post 区别 编辑:程序博客网 时间:2024/06/06 12:45
Description
In the final exam, you are given n problems to solve, each one of which has an integer value indicating its difficulty, the larger, the harder. You need to find out which problem is the hardest.
Input

Input may contain several test cases, one per line. For each test case, the first integer indicates n (1<=n<=4), the number of problems. And then n signed 32-bit integers follow. A case with n=0 indicates the end of input, which should not be processed.

Output
For each test case, you must output the difficulty value of the hardest problem in a single line.

//1157. The hardest problem#include <iostream>#include <cstdio>using namespace std ;int main (){long long test = 0 , hard_level = 0 ;while (cin >> test && test != 0){long long hardest ;cin >> hardest ;for (int i = 0 ;  i < test - 1; ++i){cin >> hard_level ;if(hardest - hard_level < 0 ){hardest = hard_level ;}}cout << hardest << endl ;}return 0 ;}


0 0
原创粉丝点击