結果

問題 No.18 うーさー暗号
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 22:21:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 4,059 ms
コンパイル使用メモリ 71,724 KB
実行使用メモリ 56,500 KB
最終ジャッジ日時 2023-09-09 11:48:33
合計ジャッジ時間 4,870 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int k = 0;
		int ans = 0;
		for(int i = 1; i <= s.length(); i++) {
			char c = s.charAt(i - 1);
			k = c - 65 - (i % 26);
			if(k < 0) {
				ans = 24 - k + 65;
			}else {
				ans = k + 65;
			}
			System.out.print((char)ans);
		}
		System.out.println("");

//		for(int i = 0; i < 26; i++) {
//			int k = 65 + i;
//			char c = (char) k;
//			System.out.println(c);
//		}
	}
}
0