結果

問題 No.18 うーさー暗号
ユーザー hnthnt
提出日時 2016-04-30 02:41:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 758 bytes
コンパイル時間 3,066 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 56,184 KB
最終ジャッジ日時 2023-09-21 12:15:32
合計ジャッジ時間 5,707 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
55,936 KB
testcase_01 AC 110 ms
55,832 KB
testcase_02 AC 117 ms
55,924 KB
testcase_03 AC 165 ms
56,184 KB
testcase_04 AC 146 ms
56,180 KB
testcase_05 AC 136 ms
55,948 KB
testcase_06 AC 159 ms
56,148 KB
testcase_07 AC 161 ms
54,400 KB
testcase_08 AC 162 ms
56,052 KB
testcase_09 AC 164 ms
55,840 KB
testcase_10 AC 116 ms
55,836 KB
testcase_11 AC 116 ms
55,776 KB
testcase_12 AC 150 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class no18 {
	public static void main(String[] args) {
		String[] az = {"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"};
		Scanner sc = new Scanner(System.in);
		Map<String,Integer> map = new HashMap<String,Integer>();
		for (int i = 0; i < az.length; i++) {
			map.put(az[i],i);
		}
		String s = sc.next();
		int N = 0;
		for (int i = 0 ; i < s.length(); i++) {
			if (map.get(String.valueOf(s.charAt(i))) - (i + 1) % 26 < 0) {
				N = 26 + map.get(String.valueOf(s.charAt(i))) - (i + 1) % 26;
			} else {
				N = map.get(String.valueOf(s.charAt(i))) - (i + 1) % 26;
			}
			System.out.print(az[N]);
		}
	}
}
0