Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int count = scan.nextInt();
- int[] arr = new int[count];
- int[] arrRe = new int[count];
- for (int x = 0; x < count; x++) {
- arr[x] = scan.nextInt();
- arrRe[x] = arr[x];
- }
- while (true) {
- boolean flag = false;
- for (int x = 1; x < count; x++) {
- if (arrRe[x] > arrRe[x-1]) {
- int temp = arrRe[x-1];
- arrRe[x-1] = arrRe[x];
- arrRe[x] = temp;
- flag = true;
- }
- }
- if (flag == false) {
- break;
- }
- }
- for (int x = 0; x < count; x++) {
- for (int y = 0; y < count; y++) {
- if (arr[x] == arrRe[y]) {
- System.out.print((y+1) + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement