結果

問題 No.3374 Caesar Shift Game
コンテスト
ユーザー テナガザル
提出日時 2025-11-21 22:14:40
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 1,020 ms
コンパイル使用メモリ 102,208 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-21 22:14:44
合計ジャッジ時間 3,563 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

void solve()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  int flag = 0;
  for (int i = 0; i < n; ++i)
  {
    if (i % 2 == 0)
    {
      if (flag || s[i] != 'C')
      {
        cout << s << endl;
        return;
      }
      else
      {
        s[i] = 'A';
      }
    }
    else
    {
      if (s[i] == 'C')
      {
        cout << s << endl;
        return;
      }
      else
      {
        if (s[i] == 'A') flag = 1;
        ++s[i];
      }
    }
  }
  cout << s << endl;
}

int main()
{
  int t;
  cin >> t;
  while (t--) solve();
}
0