import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ final int N =10; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int[] num = new int[N]; for(int i=0;i<N;i++){ num[i] = sc.nextInt(); } Arrays.sort(num); System.out.print("max="+num[N-1]); } } }
#include<iostream> using namespace std; int main() { int x; cin >> x; int maxi = x; for(int i=1; i<10; i++) { cin >> x; maxi = max(maxi, x); } cout << "max=" << maxi << endl; return 0; }
//遍历一遍就好了吧。。。 #include<iostream> using namespace std; int main(){ int n; while(cin>>n){ int a[10],max=n; for(int i=1;i<10;i++){ cin>>a[i]; if(a[i]>max) max=a[i]; } cout<<"max="<<max<<endl; } }
#include<stdio.h> int main (){//the shorter,the better. int i,t,r; for(;~scanf("%d",&r);) for (i = 1; i < 10&&~scanf("%d",&t);r=t>r?t:r,i++,i==10?printf("max=%d\n",r):0); }
#include <cstdio> #include <algorithm> using namespace std; int main(){ int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10; int maximum; while(scanf("%d%d%d%d%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10) != EOF){ maximum = max({a1,a2,a3,a4,a5,a6,a7,a8,a9,a10}); printf("max=%d",maximum); } return 0; }
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[10]; for(int i=0;i<10;i++){ cin>>a[i]; } sort(a,a+10); cout<<"max="<<a[9]; }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int len = s.length; int[] a = new int[len]; for (int i = 0; i < len; i++) { a[i] = Integer.parseInt(s[i]); } int maxindex = 0; for (int i = 0; i < len; i++) { if (a[i] > a[maxindex]) maxindex = i; } System.out.println("max=" + a[maxindex]); } }