結果

問題 No.490 yukiソート
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-03-06 14:34:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 356 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 3,652 ms
コンパイル使用メモリ 76,424 KB
実行使用メモリ 61,452 KB
最終ジャッジ日時 2023-10-19 02:21:17
合計ジャッジ時間 14,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
58,424 KB
testcase_01 AC 173 ms
58,576 KB
testcase_02 AC 169 ms
58,392 KB
testcase_03 AC 171 ms
58,504 KB
testcase_04 AC 220 ms
58,672 KB
testcase_05 AC 222 ms
58,740 KB
testcase_06 AC 215 ms
56,656 KB
testcase_07 AC 226 ms
58,664 KB
testcase_08 AC 226 ms
58,532 KB
testcase_09 AC 225 ms
58,600 KB
testcase_10 AC 222 ms
58,608 KB
testcase_11 AC 222 ms
58,584 KB
testcase_12 AC 219 ms
58,476 KB
testcase_13 AC 223 ms
58,640 KB
testcase_14 AC 352 ms
61,344 KB
testcase_15 AC 345 ms
61,244 KB
testcase_16 AC 336 ms
61,316 KB
testcase_17 AC 356 ms
61,452 KB
testcase_18 AC 345 ms
61,308 KB
testcase_19 AC 329 ms
61,440 KB
testcase_20 AC 342 ms
61,304 KB
testcase_21 AC 345 ms
61,248 KB
testcase_22 AC 331 ms
61,304 KB
testcase_23 AC 347 ms
61,368 KB
testcase_24 AC 172 ms
58,628 KB
testcase_25 AC 170 ms
58,460 KB
testcase_26 AC 173 ms
58,448 KB
testcase_27 AC 170 ms
58,388 KB
testcase_28 AC 170 ms
56,580 KB
testcase_29 AC 169 ms
58,560 KB
testcase_30 AC 172 ms
58,200 KB
testcase_31 AC 171 ms
58,372 KB
testcase_32 AC 171 ms
58,300 KB
testcase_33 AC 169 ms
58,324 KB
testcase_34 AC 170 ms
58,364 KB
testcase_35 AC 170 ms
58,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] ar = new int[n];
		for (int i=0; i<n; i++) {
			ar[i] = sc.nextInt();
		}
		
		int temp;
		for (int i=0; i<2*n-3; i++) {
			for (int p=0; p<=i; p++) {
				int q = i-p;
				if (p>=n || q>=n) {continue;}
				
				if (ar[p]<ar[q]) {
					temp = ar[p];
					ar[p] = ar[q];
					ar[q] = temp;
				}
			}
		}
		
		for (int i=0; i<n; i++) {
			out.print((i==0?"":" ")+ar[i]);
		}
		out.println();
	}
}
0