結果

問題 No.1455 拡張ROTN
ユーザー CleyLCleyL
提出日時 2021-12-18 01:59:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 68,228 KB
実行使用メモリ 8,700 KB
最終ジャッジ日時 2023-10-13 05:57:21
合計ジャッジ時間 5,043 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
string incr(string s){
  string ans = "";
  for(int i = 0; s.size() > i; i++){
    if('a' <= s[i] && s[i] <= 'z'){
      if(s[i] == 'z')ans.push_back('a');
      else ans.push_back(s[i]+1);
    }else if('A' <= s[i] && s[i] <= 'Z'){
      if(s[i] == 'Z')ans.push_back('A');
      else ans.push_back(s[i]+1);
    }else if(s[i] == '9'){
      ans = ans+"CpCzNkSuTbEoA";
    }else{
      ans.push_back(s[i]+1);
    }
  }
  return ans;
}

bool allc(string s){
  for(int i = 0; s.size() > i; i++){
    if('0' <= s[i] && s[i] <= '9'){
      return false;
    }
  }
  return true;
}
int main(){
  string s;cin>>s;
  int n;cin>>n;
  while(n && allc(s)){
    s = incr(s);
    n--;
  }
  n%=26;
  while(n){
    s = incr(s);
    n--;
  }
  cout << s << endl;
}
0