結果

問題 No.1455 拡張ROTN
ユーザー a01sa01to
提出日時 2024-11-26 00:45:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 951 bytes
コンパイル時間 3,215 ms
コンパイル使用メモリ 248,148 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 00:45:29
合計ジャッジ時間 4,195 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  string s;
  ll n;
  cin >> s >> n;
  auto op = [&]() {
    string t = "";
    for (char c : s) {
      if (islower(c)) {
        t += c + 1;
        if (t.back() > 'z') t.back() = 'a';
      }
      else if (isupper(c)) {
        t += c + 1;
        if (t.back() > 'Z') t.back() = 'A';
      }
      else if (isdigit(c)) {
        t += c + 1;
        if (t.back() > '9') {
          t.pop_back();
          t += "CpCzNkSuTbEoA";
        }
      }
      else {
        assert(false);
      }
    }
    swap(s, t);
  };
  rep(_, min(n, 20LL)) op();
  n = max(n - 20, 0LL);
  if (n != 0) for (char c : s) assert(islower(c) || isupper(c));
  n %= 26;
  rep(_, n) op();
  cout << s << endl;
  return 0;
}
0