hwangnk1004 / Algorithm

0 stars 0 forks source link

StepByStep #최소위치출력 #255

Open hwangnk1004 opened 4 years ago

hwangnk1004 commented 4 years ago

import java.util.Scanner;

public class Main { public static void main(String args[]) {

    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();

    int[] arr = new int[n];
    for(int i=0; i<arr.length; i++ ) {
        arr[i] =scanner.nextInt();
    }

    int sum = 100000000;

    for(int i=0; i<arr.length ; i++) {
        sum = Math.min(sum,arr[i]);
    }

    for(int i=0; i<arr.length; i++) {
        if (arr[i] == sum) {
            System.out.print(i+1+" ");
        }
    }
}

}