結果

問題 No.18 うーさー暗号
ユーザー spaciaspacia
提出日時 2015-12-16 09:41:20
言語 Java19
(openjdk 21)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 852 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 74,732 KB
実行使用メモリ 53,140 KB
最終ジャッジ日時 2023-09-21 12:01:17
合計ジャッジ時間 4,069 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
52,892 KB
testcase_01 AC 93 ms
52,316 KB
testcase_02 AC 82 ms
52,652 KB
testcase_03 AC 98 ms
52,996 KB
testcase_04 AC 82 ms
52,696 KB
testcase_05 AC 82 ms
52,192 KB
testcase_06 AC 95 ms
52,468 KB
testcase_07 AC 88 ms
52,584 KB
testcase_08 AC 89 ms
53,104 KB
testcase_09 AC 85 ms
52,564 KB
testcase_10 AC 81 ms
52,292 KB
testcase_11 AC 84 ms
53,140 KB
testcase_12 AC 86 ms
52,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main18 {
	
	public static String solve (String code) {
		String ret = "";
		char[] alp = {'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'};
		for (int i = 0; i < alp.length / 2; i++) {
			char tmp = alp[i];
			alp[i] = alp[alp.length - i - 1];
			alp[alp.length - i - 1] = tmp;
		}
		for (int i = 0; i < code.length(); i++) {
			char c = code.charAt(i);
			for (int j = 0; j < alp.length; j++) {
				if (c != alp[j]) continue;
				ret += "" + alp[(i + j + 1) % alp.length];
				break;
			}
		}
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String line = br.readLine();
		
		System.out.println(solve(line));
	}
}
0