akeru1101   3년 전

틀리는 이유를 모르겠습니다ㅠㅠ 도움주시면 감사하겠습니다.

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.<i>in</i>);
        int[] num= new int[3];
        int how_same =0;
        int what_same =0;


        for (int i=0; i< num.length; i++){
            num[i] = sc.nextInt();
        }
        int max=num[0];
        for (int i=0; i<num.length; i++){
            if (num[i]==num[(i+1)%3]){
                how_same++;
                what_same =num[i];
            }
            if (num[i]<num[(i+1)%3]){
                max = num[(i+1)%3];
            }
        }
        if (how_same==3){
            System.<i>out</i>.println(10000+what_same*1000);
        }
        else if (how_same==1){
            System.<i>out</i>.println(1000+what_same*100);
        }
        else {
            System.<i>out</i>.println(max*100);
        }
    }
}

댓글을 작성하려면 로그인해야 합니다.