結果

問題 No.18 うーさー暗号
ユーザー eagleeagle
提出日時 2022-06-16 14:10:42
言語 Java19
(openjdk 21)
結果
RE  
実行時間 -
コード長 775 bytes
コンパイル時間 3,759 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 58,284 KB
最終ジャッジ日時 2023-07-28 17:59:14
合計ジャッジ時間 5,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,756 KB
testcase_01 AC 119 ms
55,688 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] moji = {'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 < S.length(); i++) {
			char c = S.charAt(i);
			int idx = 0;
			for(int j = 0; j < moji.length; j++) {
				if(moji[j] == c) {
					idx = j;
					break;
				}
			}
			if(0 > idx - (i + 1)) {
				idx = (idx - (i + 1)) * (-1);
				idx = idx % moji.length;
				idx = moji.length - idx;
			} else {
				idx = idx - (i + 1);
			}
			System.out.print(moji[idx]);
		}
		System.out.println();
	}
}
0