結果

問題 No.1455 拡張ROTN
ユーザー bluemeganebluemegane
提出日時 2021-04-01 14:35:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,382 bytes
コンパイル時間 1,097 ms
コンパイル使用メモリ 65,368 KB
実行使用メモリ 22,824 KB
最終ジャッジ日時 2023-08-22 18:07:02
合計ジャッジ時間 3,438 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,732 KB
testcase_01 AC 56 ms
20,792 KB
testcase_02 AC 55 ms
18,628 KB
testcase_03 AC 53 ms
20,772 KB
testcase_04 AC 54 ms
22,772 KB
testcase_05 AC 53 ms
20,792 KB
testcase_06 AC 53 ms
22,756 KB
testcase_07 AC 55 ms
20,860 KB
testcase_08 AC 54 ms
18,728 KB
testcase_09 AC 54 ms
20,636 KB
testcase_10 AC 53 ms
20,688 KB
testcase_11 AC 54 ms
20,672 KB
testcase_12 AC 54 ms
20,764 KB
testcase_13 AC 53 ms
20,628 KB
testcase_14 AC 54 ms
22,692 KB
testcase_15 AC 53 ms
18,704 KB
testcase_16 AC 54 ms
22,684 KB
testcase_17 AC 53 ms
20,768 KB
testcase_18 AC 54 ms
20,696 KB
testcase_19 AC 53 ms
20,676 KB
testcase_20 AC 53 ms
20,696 KB
testcase_21 AC 53 ms
20,812 KB
testcase_22 AC 55 ms
22,824 KB
testcase_23 AC 54 ms
20,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    public static string x0 = "CpCzNkSuTbEoA";
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        var n = long.Parse(Console.ReadLine().Trim());
        getAns(s, n);
    }
    static void getAns (string s, long n)
    {
        var ans = "";
        var n26 =(int)( n % 26);
        foreach(var  x in s)
        {
            int tp;
            if (int.TryParse(x.ToString(), out tp)) ans += changeN(tp, n);
            else ans += changeC(x, n26);
        }
        Console.WriteLine(ans);
    }
    static string changeN (int t  , long a)
    {
        if (t + a <= 9) return (t + a).ToString();
        else
        {
            var ans = "";
            var a2 = (int)((t + a - 10) % 26);
            foreach(var x in x0)
            {
                ans += changeC(x, a2); 
            }
            return ans;
        }
    }
    static string changeC(char t, int a )
    {
        var s = "abcdefghijklmnopqrstuvwxyz";
        var s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        if (char.IsUpper(t))
        {
            var sh = t - 'A';
            sh += a;
            if (sh >= 26) sh -= 26;
            return s2[sh].ToString();
        }
        else
        {
            var sh = t - 'a';
            sh += a;
            if (sh >= 26) sh -= 26;
            return s[sh].ToString();
        }
    }
}
0