結果

問題 No.1455 拡張ROTN
ユーザー masutech16
提出日時 2021-03-31 21:45:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 2,436 bytes
コンパイル時間 2,892 ms
コンパイル使用メモリ 194,604 KB
最終ジャッジ日時 2025-01-20 03:06:27
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#line 1 "/workspaces/compro/lib/template.hpp"
#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>
#ifndef IO_VECTOR
#define IO_VECTOR
template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
int size = v.size();
for (int i = 0; i < size; i++) {
std::cout << v[i];
if (i != size - 1)
std::cout << " ";
}
return out;
}
template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
for (auto &el : v) {
std::cin >> el;
}
return in;
}
#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<
using namespace std;
template <class T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <class T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
// O(NlogN)
template <class T> void unique(std::vector<T> &v) {
std::sort(v.begin(), v.end());
v.erase(std::unique(v.begin(), v.end()), v.end());
}
#line 2 "main.cpp"
string solve(string S, ll N) {
ll num = min(10LL, N);
string ans = S;
REP(i, num) {
int len = ans.length();
string tmp;
REP(j, len) {
if (ans[j] == '9') {
tmp += "CpCzNkSuTbEoA";
} else if ('0' <= ans[j] && ans[j] <= '8') {
tmp.push_back(ans[j] + 1);
} else if ('a' <= ans[j] && ans[j] <= 'z') {
int po = (ans[j] - 'a' + 1) % 26;
tmp.push_back('a' + po);
} else if ('A' <= ans[j] && ans[j] <= 'Z') {
int po = (ans[j] - 'A' + 1) % 26;
tmp.push_back('A' + po);
}
}
ans = tmp;
}
N -= 10;
if (N < 0) {
return ans;
}
int len = ans.length();
REP(i, len) {
if ('a' <= ans[i] && ans[i] <= 'z') {
ll po = (N + ans[i] - 'a') % 26;
ans[i] = 'a' + po;
} else if ('A' <= ans[i] && ans[i] <= 'Z') {
int po = (N + ans[i] - 'A') % 26;
ans[i] = 'A' + po;
}
}
return ans;
}
// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
string S;
ll N;
std::cin >> S >> N;
auto ans = solve(S, N);
std::cout << ans << std::endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0