結果

問題 No.3374 Caesar Shift Game
コンテスト
ユーザー butsurizuki
提出日時 2025-11-21 21:50:54
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 2,965 ms
コンパイル使用メモリ 275,916 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-21 21:50:59
合計ジャッジ時間 5,339 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 17 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while(t>0){
    t--;
    int n;
    string s;
    cin >> n >> s;
    int kill=0;
    for(int i=0;i<n;i++){
      if(i&1){
        if(s[i]=='A'){s[i]='B'; kill=1;}
        if(s[i]=='B'){s[i]='C';}
        if(s[i]=='C'){break;}
      }
      else{
        if(kill){break;}
        if(s[i]=='A'){break;}
        if(s[i]=='B'){break;}
        if(s[i]=='C'){
          s[i]='A';
        }
      }
    }
    cout << s << "\n";
  }
  return 0;
}
0