3725. 陶陶考试
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
陶陶正在进行考试,他做题时习惯从最难的题目开始做起。试卷上每道题目的难度都用一个整数来表示,他需要从中找到最难的题目的难度。
Input
有很多测试样例,每个测试样例用两行表示,第一行表示试卷上多少道题目(假设为n道)。下一行包含n个整数,顺序表示试卷上每道题目的难度。当n为0时,输入结束
Output
每个样例对应输出仅有一个数字的一行,表示最难的难度是多少。
Sample Input
3
2 5 4
5
1 8 4 2 6
4
9 1 4 2
0
Sample Output
5
8
9
Hint
程序的输入和输出不冲突 不需要等到程序输入结束再进行输出
// Problem#: 3725
// Submission#: 1984652
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
while(n!=0){
int temp,highest=0,i;
for(i=0;i<n;i++){
cin>>temp;
if(temp>highest){
highest=temp;
}
}
cout<<highest<<endl;
cin>>n;
}
return 0;
}