結果

問題 No.18 うーさー暗号
ユーザー jimanojimano
提出日時 2016-06-19 14:17:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 803 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 72,192 KB
実行使用メモリ 51,704 KB
最終ジャッジ日時 2023-09-21 12:20:17
合計ジャッジ時間 3,331 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,456 KB
testcase_01 AC 42 ms
49,348 KB
testcase_02 AC 45 ms
49,304 KB
testcase_03 AC 88 ms
51,704 KB
testcase_04 AC 55 ms
49,656 KB
testcase_05 AC 54 ms
49,524 KB
testcase_06 AC 70 ms
51,284 KB
testcase_07 AC 83 ms
50,552 KB
testcase_08 AC 86 ms
51,340 KB
testcase_09 AC 81 ms
51,480 KB
testcase_10 AC 42 ms
49,216 KB
testcase_11 AC 43 ms
49,460 KB
testcase_12 AC 60 ms
51,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

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

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			char[] arc = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
					'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
			char[] c = br.readLine().toCharArray();

			for (int i = 0; i < c.length; i++) {
				for (int j = 0; j < arc.length; j++) {
					int idx = j - (i % 26) - 1;
					if (c[i] == arc[j]) {
						if (idx < 0) {
							System.out.print(arc[idx + 26]);
						} else {
							System.out.print(arc[idx]);
						}
					}
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0