結果

問題 No.18 うーさー暗号
ユーザー abcabc
提出日時 2016-10-17 18:30:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 172 ms / 5,000 ms
コード長 413 bytes
コンパイル時間 3,155 ms
コンパイル使用メモリ 71,200 KB
実行使用メモリ 57,244 KB
最終ジャッジ日時 2023-09-21 12:30:35
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,532 KB
testcase_01 AC 121 ms
55,436 KB
testcase_02 AC 126 ms
55,680 KB
testcase_03 AC 170 ms
55,852 KB
testcase_04 AC 161 ms
54,232 KB
testcase_05 AC 149 ms
56,112 KB
testcase_06 AC 170 ms
57,244 KB
testcase_07 AC 170 ms
56,116 KB
testcase_08 AC 169 ms
55,884 KB
testcase_09 AC 162 ms
55,820 KB
testcase_10 AC 128 ms
55,432 KB
testcase_11 AC 127 ms
55,916 KB
testcase_12 AC 172 ms
55,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        for (int i = 0; i < s.length(); i++) {

            int charIndex = (s.charAt(i) - 'A' - (i + 1)) % 26;
            char character = (char) (((charIndex + 26) % 26) + 'A');
            System.out.print(character);

        }

    }

}
0