結果

問題 No.2671 NUPC Decompressor
ユーザー ks2mks2m
提出日時 2024-03-15 21:45:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 4,075 ms
コンパイル使用メモリ 75,756 KB
実行使用メモリ 58,092 KB
最終ジャッジ日時 2024-03-15 21:45:37
合計ジャッジ時間 7,053 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,940 KB
testcase_01 AC 129 ms
57,708 KB
testcase_02 AC 131 ms
57,804 KB
testcase_03 AC 132 ms
57,940 KB
testcase_04 AC 134 ms
57,928 KB
testcase_05 AC 122 ms
56,684 KB
testcase_06 AC 132 ms
57,716 KB
testcase_07 AC 131 ms
57,824 KB
testcase_08 AC 132 ms
57,828 KB
testcase_09 AC 132 ms
58,092 KB
testcase_10 AC 119 ms
56,684 KB
testcase_11 AC 136 ms
57,840 KB
testcase_12 AC 131 ms
57,840 KB
testcase_13 AC 135 ms
57,688 KB
testcase_14 AC 141 ms
57,976 KB
testcase_15 AC 138 ms
57,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		sc.close();

		int n = 4;
		int n2 = 16;
		char[] s = {'N', 'U', 'P', 'C'};
		List<String> list = new ArrayList<>();
		for (int i = 0; i < n2; i++) {
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < n; j++) {
				sb.append(s[j]);
				if ((i >> j & 1) == 1) {
					sb.append(sb);
				}
			}
			list.add(sb.toString());
		}
		Collections.sort(list);
		System.out.println(list.get(k - 1));
	}
}
0