結果

問題 No.18 うーさー暗号
ユーザー atkrymatkrym
提出日時 2016-11-07 17:43:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 4,275 ms
コンパイル使用メモリ 72,620 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-21 12:32:49
合計ジャッジ時間 5,071 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,484 KB
testcase_01 AC 121 ms
55,820 KB
testcase_02 AC 123 ms
56,024 KB
testcase_03 AC 127 ms
56,012 KB
testcase_04 AC 124 ms
55,816 KB
testcase_05 AC 125 ms
55,764 KB
testcase_06 AC 126 ms
55,696 KB
testcase_07 AC 125 ms
55,668 KB
testcase_08 AC 126 ms
56,008 KB
testcase_09 AC 130 ms
55,576 KB
testcase_10 AC 122 ms
55,828 KB
testcase_11 AC 122 ms
55,616 KB
testcase_12 AC 127 ms
56,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < s.length();i++) {
            char c = s.charAt(i);
            int val = (int)c-(i+1)%26;
            if (val < 65) val += 26;
            sb.append((char)val);
        }
        System.out.println(sb.toString());
    }
}
0