2107 ACM 水题

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2107

题意:比较大小,即使简单还是没有一次过,粗心的我,终于放假了,虽然我平时课还是有点多,但是希望自己能坚持写下去

#include<stdio.h>
#define max(a,b) (a>b)?a:b
int main()
{
    int n,a[101],Max;
    while(scanf("%d",&n)!=EOF&&n!=0)
    {
        int i=0;
        Max=0;
        for(i;i<n;i++)
        {
            scanf("%d",&a[i]);
            Max=max(Max,a[i]);
        }
           printf("%d
",Max);
    }
}

C语言没有max,需要自己添加,c++的话,头文件里有

#include <algorithm>

原文地址:https://www.cnblogs.com/CheeseIce/p/9606752.html