結果

問題 No.2226 Hello, Forgotten World!
ユーザー publfl2publfl2
提出日時 2023-02-24 21:39:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 831 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 05:59:14
合計ジャッジ時間 929 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
char x[1010],y[1010]="helloworld";
int func(int k, int mode)
{
	if(mode==0)
	{
		for(int i=k;i<=k+9;i++) if(x[i]!=y[i-k]) return 0;
		return 1;
	}
	else
	{
		for(int i=k;i<=k+9;i++) if(x[i]!=y[i-k] && x[i]!='?') return 0;
		return 1;
	}
}

int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int a;
		scanf("%d",&a);
		scanf("%s",x+1);
		for(int i=1;i+9<=a;i++)
		{
			if(func(i,0))
			{
				for(int j=1;j<=a;j++) if(x[j]=='?') x[j] = 'a';
				for(int j=1;j<=a;j++) printf("%c",x[j]);
				printf("\n");
				goto u;
			}
		}
		
		for(int i=1;i+9<=a;i++)
		{
			if(func(i,1))
			{
				for(int j=i;j<=i+9;j++) x[j] = y[j-i];
				for(int j=1;j<=a;j++) if(x[j]=='?') x[j] = 'a';
				for(int j=1;j<=a;j++) printf("%c",x[j]);
				printf("\n");
				goto u;
			}
		}
		printf("-1\n");
		
		u:;
	}
}
0