結果

問題 No.18 うーさー暗号
ユーザー nglkrianbrjfnglkrianbrjf
提出日時 2016-02-27 02:03:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 2,874 ms
コンパイル使用メモリ 73,044 KB
実行使用メモリ 49,420 KB
最終ジャッジ日時 2023-09-21 12:08:23
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
49,252 KB
testcase_01 AC 39 ms
49,192 KB
testcase_02 AC 38 ms
49,252 KB
testcase_03 AC 41 ms
49,320 KB
testcase_04 AC 38 ms
49,224 KB
testcase_05 AC 40 ms
49,172 KB
testcase_06 AC 40 ms
49,420 KB
testcase_07 AC 41 ms
49,356 KB
testcase_08 AC 41 ms
49,160 KB
testcase_09 AC 40 ms
49,164 KB
testcase_10 AC 38 ms
49,268 KB
testcase_11 AC 40 ms
49,356 KB
testcase_12 AC 41 ms
49,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Question18 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line;

		try{
			line = in.readLine();
		}catch(IOException e){
			System.out.println("-1");
			return;
		}

		int max = line.length();
		StringBuffer result = new StringBuffer();

		for(int i = 0; i < max; i++){
			int x = (i + 1) % 26;
			int d = line.charAt(i) - 65;
			char c = (char)(65+(d - x + 26)%26);
			result.append(c);
		}

		System.out.println(result.toString());
	}

}
0