結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
publfl2
|
| 提出日時 | 2023-02-24 21:39:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 831 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 32,896 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 05:14:00 |
| 合計ジャッジ時間 | 834 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
#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:;
}
}
publfl2