-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheje1318.java
More file actions
33 lines (32 loc) · 1.09 KB
/
eje1318.java
File metadata and controls
33 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
import java.util.Arrays;
public class eje1318
{
public static void main(String [] args){
Scanner lee = new Scanner(System.in);
String [] cad1 = lee.nextLine().split(" ");
String orden = lee.nextLine();
int [] abc = new int[3];
for(int i=0; i<3; i++){
abc[i] = Integer.parseInt(cad1[i]);
}
int menor = 100;
int mayor = 0;
int medio = 0;
for(int i = 0; i < 3; i++) if(menor > abc[i]) menor = abc[i];
for(int i = 0; i < 3; i++) if(mayor < abc[i]) mayor = abc[i];
for(int i = 0; i < 3; i++)
if ( abc[i] != mayor && abc[i] != menor )
medio = abc[i];
for ( int i = 0; i < 3; i++ ){
if ( orden.charAt(i) == 'A' )
System.out.print(menor);
else if ( orden.charAt(i) == 'B' )
System.out.print(medio);
else if ( orden.charAt(i) == 'C' )
System.out.print(mayor);
if ( i != 2 )
System.out.print(" ");
}
}
}