結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-04 09:41:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 784 bytes |
| コンパイル時間 | 718 ms |
| コンパイル使用メモリ | 81,800 KB |
| 実行使用メモリ | 15,944 KB |
| 最終ジャッジ日時 | 2025-08-04 09:42:03 |
| 合計ジャッジ時間 | 8,878 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | WA * 4 TLE * 2 -- * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf ("%d", &T);
| ~~~~~~^~~~~~~~~~
ソースコード
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
int main ()
{
int T;
scanf ("%d", &T);
while (T --)
{
string str;
cin >> str;
int n = str.size ();
bool have_ans = false;
for (int i = 0; i <= n; i ++)
{
bool ok = false;
for (char ch = 'a'; ch <= 'z'; ch ++)
{
bool ak = true;
string l = "";
for (int j = 0, k = 0; j <= n; j ++)
if (j == i)
l.push_back(ch);
else
{
l.push_back(str[k]);
k ++;
}
for (int j = 0; j < l.size(); j ++)
if (l[j] != l[n - j])
{
ak = false;
break;
}
if (ak)
{
cout << l << endl;
ok = true;
break;
}
}
if (ok)
{
have_ans = true;
break;
}
}
if (!have_ans)
puts("NA");
}
}
vjudge1