JustOj 1929: 多输入输出练习1

题目描述

给定很多行数据,要求输出每一行的最大值.

输入

程序有多行输入,每一行以0结束.

输出

有多行输出,对应输入的行数.

样例输入
23 -456 33 78 0
43 23 987 66 -137 324 0
544 27 7 9 102 234 -44 -732 723 0
样例输出
78
987
723

题解:...
 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstring>
 4 #include <cstdio>
 5 #include <vector>
 6 #include <cstdlib>
 7 #include <iomanip>
 8 #include <cmath>
 9 #include <ctime>
10 #include <map>
11 #include <set>
12 using namespace std;
13 #define lowbit(x) (x&(-x))
14 #define max(x,y) (x>y?x:y)
15 #define min(x,y) (x<y?x:y)
16 #define MAX 100000000000000000
17 #define MOD 1000000007
18 #define pi acos(-1.0)
19 #define ei exp(1)
20 #define PI 3.141592653589793238462
21 #define INF 0x3f3f3f3f3f
22 #define mem(a) (memset(a,0,sizeof(a)))
23 typedef long long ll;
24 ll gcd(ll a,ll b){
25     return b?gcd(b,a%b):a;
26 }
27 bool cmp(int x,int y)
28 {
29     return x>y;
30 }
31 const int N=10005;
32 const int mod=1e9+7;
33 
34 int main()
35 {
36     std::ios::sync_with_stdio(false);
37     int n;
38     while(cin>>n){
39         int t,s=n;
40         while(cin>>t&&t){
41             if(t>s)  s=t;
42         }
43         cout<<s<<endl;
44     }
45     return 0;
46 }
原文地址:https://www.cnblogs.com/wydxry/p/7268395.html