結果

問題 No.1455 拡張ROTN
ユーザー 斎藤健太斎藤健太
提出日時 2021-03-31 22:43:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,136 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 171,384 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 09:21:50
合計ジャッジ時間 3,058 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
const ll dx[4] = {1,0,-1,0};
const ll dy[4] = {0,1,0,-1};
ll mod(ll x, ll m){return x & m;}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}
ll yaku(ll x){
    ll cnt = 0;
    for(int i = 1; i * i <= x; i++){
        if(x % i == 0){
            if(i == x / i) cnt++;
            else cnt += 2;
        }
    }
    return cnt;
}
ll modwaru(ll a, ll b, ll m){
    a %= m;
    return a * modinv(b, m) % m;
}
ll gcd(ll x, ll y){
    if(x % y == 0)return y;
    else return gcd(y, x % y); 
}

int main(){
    string S, T = "";
    ll N;
    cin >> S >> N;
    vector<string> cpc(26, "CpCzNkSuTbEoA");
    for(int i = 1; i < 26; i++){
        for(int j = 0; j < 13; j++){
            if(cpc[i][j] >= 97 && cpc[i][j] <= 122){
                cpc[i][j] = cpc[i - 1][j] + 1;
                if(cpc[i][j] > 122) cpc[i][j] -= 26;
            }else{
                cpc[i][j] = cpc[i - 1][j] + 1;
                if(cpc[i][j] > 90) cpc[i][j] -= 26;
            }
        }
    }
    for(int i = 0; i < S.size(); i++){
        if(S[i] >= 97 && S[i] <= 122){
            S[i] += N % 26;
            if(S[i] > 122) S[i] -= 26;
            T.push_back(S[i]);
        }else if(S[i] >= 65 && S[i] <= 90){
            S[i] += N % 26;
            if(S[i] > 90) S[i] -= 26;
            T.push_back(S[i]);
        }else{
            for(int j = 0; j < 13; j++){
                if(N - (58 - S[i]) >= 0){T.push_back(cpc[(N - (58 - S[i])) % 26][j]);}
                else{
                    T.push_back(S[i] + N % 26);
                    break;
                }
            }
        }
    }
    cout << T << endl;
}
0