結果

問題 No.1455 拡張ROTN
ユーザー tentententen
提出日時 2021-04-13 08:57:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 1,601 bytes
コンパイル時間 2,281 ms
コンパイル使用メモリ 74,796 KB
実行使用メモリ 50,032 KB
最終ジャッジ日時 2023-09-11 12:32:41
合計ジャッジ時間 5,230 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,060 KB
testcase_01 AC 44 ms
49,024 KB
testcase_02 AC 49 ms
49,552 KB
testcase_03 AC 48 ms
49,116 KB
testcase_04 AC 50 ms
49,152 KB
testcase_05 AC 47 ms
49,116 KB
testcase_06 AC 54 ms
50,032 KB
testcase_07 AC 50 ms
49,428 KB
testcase_08 AC 48 ms
49,124 KB
testcase_09 AC 48 ms
49,436 KB
testcase_10 AC 46 ms
49,060 KB
testcase_11 AC 46 ms
49,180 KB
testcase_12 AC 45 ms
49,100 KB
testcase_13 AC 43 ms
49,308 KB
testcase_14 AC 45 ms
48,996 KB
testcase_15 AC 45 ms
49,344 KB
testcase_16 AC 44 ms
49,120 KB
testcase_17 AC 45 ms
48,960 KB
testcase_18 AC 45 ms
49,248 KB
testcase_19 AC 46 ms
49,244 KB
testcase_20 AC 46 ms
49,164 KB
testcase_21 AC 46 ms
49,140 KB
testcase_22 AC 43 ms
49,056 KB
testcase_23 AC 46 ms
49,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        String s = sc.next();
        long n = sc.nextLong();
        for (int i = 0; i < Math.min(10, n); i++) {
            s = change(s);
        }
        n = Math.max(0, n - 10);
        n %= 26;
        for (int i = 0; i < n; i++) {
            s = change(s);
        }
        System.out.println(s);
    }
    
    static String change(String s) {
        StringBuilder ans = new StringBuilder();
        for (char c : s.toCharArray()) {
            if (c >= 'a' && c <= 'z') {
                ans.append((char)((c - 'a' + 1) % 26 + 'a'));
            } else if (c >= 'A' && c <= 'Z') {
                ans.append((char)((c - 'A' + 1) % 26 + 'A'));
            } else if (c == '9') {
                ans.append("CpCzNkSuTbEoA");
            } else {
                ans.append((char)(c + 1));
            }
        }
        return ans.toString();
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0