結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2016-03-15 16:50:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 620 ms |
コンパイル使用メモリ | 62,392 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 13:36:16 |
合計ジャッジ時間 | 1,521 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:33:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 33 | cout << ans << endl; | ^~~
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (i = s; i >= e; i--)#define rrep(i,n) RREP(i,n,0)#define REP(i,s,e) for (i = s; i < e; i++)#define rep(i,n) REP(i,0,n)#define INF 1e8typedef long long ll;bool check(string s) {int i, n = s.size();rep (i, n/2+1) {if (s[i] != s[n-i-1])return false;}return true;}int main() {int i, j, ans;string s;cin >> s;REP (i,1,s.size()) {rep (j,s.size()-i+1) {if (check(s.substr(j,i)))ans = i;}}cout << ans << endl;return 0;}