結果
| 問題 |
No.588 空白と回文
|
| コンテスト | |
| ユーザー |
zaichu
|
| 提出日時 | 2017-11-15 22:25:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 1,487 ms |
| コンパイル使用メモリ | 166,864 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 04:00:59 |
| 合計ジャッジ時間 | 2,890 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y)
{
if (y == 0)
return x;
return gcd(y, x % y);
}
template <typename T>
T lcm(T x, T y)
{
if (x == 0 || y == 0)
return 0;
return x / gcd(x, y) * y;
}
int main()
{
string s;
cin >> s;
int n = s.size();
int ans = 0;
for (int i = 0; i < n; i++)
{
for (int j = n - 1; j > i; j--)
{
if (s[i] != s[j])
continue;
int cnt = 0;
int l = i, r = j;
while (l <= r)
{
if (s[l] == s[r])
cnt += (l == r ? 1 : 2);
l++;
r--;
}
ans = max(ans, cnt);
}
}
cout << ans << endl;
}
zaichu