結果

問題 No.18 うーさー暗号
ユーザー pao2pao2pao2pao2
提出日時 2022-07-30 08:01:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 5,000 ms
コード長 453 bytes
コンパイル時間 3,367 ms
コンパイル使用メモリ 73,376 KB
実行使用メモリ 57,248 KB
最終ジャッジ日時 2023-09-27 08:53:56
合計ジャッジ時間 6,215 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
56,620 KB
testcase_01 AC 157 ms
56,800 KB
testcase_02 AC 158 ms
57,084 KB
testcase_03 AC 172 ms
57,020 KB
testcase_04 AC 162 ms
56,776 KB
testcase_05 AC 164 ms
57,000 KB
testcase_06 AC 167 ms
56,632 KB
testcase_07 AC 171 ms
57,248 KB
testcase_08 AC 173 ms
56,848 KB
testcase_09 AC 179 ms
56,940 KB
testcase_10 AC 160 ms
56,888 KB
testcase_11 AC 159 ms
56,760 KB
testcase_12 AC 171 ms
56,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		System.out.println(decrypt(s));

		sc.close();
	}

	static char cDecrypt(char c, int i) {
		return (char)('A' + ((c - i % 26) - 'A' + 26) % 26);
	}

	static String decrypt(String s) {
		String re = "";
		for (int i = 0; i < s.length(); i++)
			re += cDecrypt(s.charAt(i), i + 1);
		return re;
	}
}
0