Sicily 1157 The hardest problem

大水题, 但是不注意还是会WA的. 注意题目中说的是n signed 32-bit integers. 即你的max值初始不能为0.

 

代码
#include <stdio.h>

int main()
{
int n, curnum, maxnum, i;
while(scanf("%d", &n) && n)
{
scanf(
"%d", &maxnum);

for(i = 1; i < n; i++)
{
scanf(
"%d", &curnum);

if(curnum > maxnum)
maxnum
= curnum;
}
printf(
"%d\n", maxnum);
}
return 0;
}

 

 

posted @ 2010-11-05 17:06  普兒  阅读(355)  评论(0编辑  收藏  举报