游客 Signup | Login
中文 | En

1109 - C语言2.6

输入10个整数,输出其中最大的数。

Input

输入包含10行,每一行一个整数。

Output

请输出读入的10个数中的最大值。请注意行尾输出换行。

Examples

Input

10
6
1
3
5
87
100
25
111
56

Output

111

Solution C

#include <stdio.h>
int main()
{
    int i,max;
    int buf[10];
    for(i=0;i<=9;i++)
        scanf("%d\n",&buf[i]);
    max=buf[0];
    for (i=1;i<10;i++)
    {   
        if(buf[i]>max)
            max=buf[i];
    }
    printf("%d\n",max);
}

Solution C++

#include<iostream>
using namespace std;
int main()
{
  int a,max=-0xffff;
  while(cin >> a){
    if(a > max)
      max = a;
  }
  cout << max << endl;
  return 0;
}
Time Limit 1 second
Memory Limit 32 MB
Discuss Stats
上一题 下一题