結果

問題 No.18 うーさー暗号
ユーザー nglkrianbrjf
提出日時 2016-02-27 02:03:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 2,585 ms
コンパイル使用メモリ 74,732 KB
実行使用メモリ 50,272 KB
最終ジャッジ日時 2024-07-07 06:00:40
合計ジャッジ時間 3,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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