求三個整數的最大值
Problem Description
Input
Output
Example Input
5,7,9
Example Output
max=9
01 |
import java.util.*; |
02 |
03 |
public class Main
{ |
04 |
public static void main(String
args[]){ |
05 |
Scanner
input = new Scanner(System.in); |
06 |
String
aa = null ; |
07 |
aa
= input.nextLine(); |
08 |
String[]
bb = aa.split( "," ); |
09 |
|
10 |
int max
= 0 ; |
11 |
int []
cc = new int [bb.length]; |
12 |
for ( int i
= 0 ;i<bb.length;i++){ |
13 |
cc[i]
= Integer.parseInt(bb[i]); |
14 |
} |
15 |
|
16 |
for ( int i
= 0 ;
i <cc.length ; i++ ) { |
17 |
|
18 |
if (cc[i]>max){ |
19 |
max
= cc[i]; |
20 |
} |
21 |
} |
22 |
System.out.println( "max=" +max); |
23 |
} |
24 |
} |
25 |