[sicily]1157. The hardest problem
2015-09-24 21:15
357 查看
1157. The hardest problem
Constraints
Time Limit: 1 secs, Memory Limit: 32 MBDescription
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.Sample Input
1 1
2 1 2
3 1 3 2
4 1 2 3 4
0
Sample Output
1
2
3
4
简单求最大值问题,注意有负数存在
#include <iostream>#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
while(cin>>n && n!=0)
{
int tmp, max=-65535;
for(int i=0; i<n; i++)
{
cin>>tmp;
if(tmp > max)
max = tmp;
}
cout<<max<<endl;
}
// system("pause");
return 0;
}
Submit
相关文章推荐
- sicily 1020. Big Integer
- soj1041. Pushing Boxes
- Sicily 1046, Plane Spotting
- SICILY 1934 移动小球
- 1920. Divide The Stones
- 1801. Reading books
- 1874. Three little pigs
- Sicily 1121. Tri Tiling
- Sicily 1090. Highways
- Sicily 1155. Can I Post the lette
- Sicily 1200. Stick
- Sicily 1342. 开心的金明
- Sicily 1153. 马的周游问题
- Sicily 1171. The Game of Efil
- 1007[To and Fro]
- 1014[Specialized Four-Dig]
- 1024[MJ, Nowhere to Hide]
- 1036[Crypto Columns]
- 1147[谁拿了最多奖学金]
- 1157[The hardest problem]