結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2015-08-28 22:41:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 34,540 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 11:48:48 |
合計ジャッジ時間 | 1,646 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 20 WA * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | char s[51];scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#include <cstdio> #include <algorithm> #include <cstring> #include <cstdlib> using namespace std; //namaega184 int main(){ char s[51];scanf("%s",s); int len=strlen(s),ans=0; int cnt=0; for(int i=0;i<len;i++){ for(int j=i+1;j<len;j++){ bool f=1; for(int a=i,b=j;a<b;a++,b--){ if(s[a]!=s[b]){f=0;break;} } if(f){if(j+1-i>ans)ans=j+1-i;} } } printf("%d\n",ans); return 0; }