結果

問題 No.3374 Caesar Shift Game
コンテスト
ユーザー pengin_2000
提出日時 2025-11-21 23:35:16
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 26,828 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-21 23:35:19
合計ジャッジ時間 2,036 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘solve’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~
main.c: In function ‘main’:
main.c:30:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%d", &t);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
char s[500005];
void solve()
{
	int n;
	scanf("%d", &n);
	int i;
	scanf("%s", s);
	for (i = 0; i < n; i++)
	{
		if (i % 2 > 0)
		{
			if (s[i] == 'C')
				break;
			s[i]++;
		}
		else
		{
			if (s[i] != 'C')
				break;
			s[i] = 'A';
		}
	}
	printf("%s\n", s);
	return;
}
int main()
{
	int t;
	scanf("%d", &t);
	for (; t > 0; t--)
		solve();
	return 0;
}
0