結果

問題 No.3132 暗号メッセージ
ユーザー ks2m
提出日時 2025-05-02 21:24:59
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 2,961 ms
コンパイル使用メモリ 89,312 KB
実行使用メモリ 54,628 KB
最終ジャッジ日時 2025-05-02 21:25:06
合計ジャッジ時間 6,412 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();

		PriorityQueue<Obj> que = new PriorityQueue<>((o1, o2) -> o1.d - o2.d);
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.d = d[i];
			que.add(o);
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			Obj o = que.poll();
			int a = o.d % 26;
			sb.append((char) ('A' + a));
		}
		System.out.println(sb.toString());
	}

	static class Obj {
		int i, d;
	}
}
0