結果
| 問題 |
No.273 回文分解
|
| ユーザー |
184
|
| 提出日時 | 2015-08-28 22:54:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 414 bytes |
| コンパイル時間 | 376 ms |
| コンパイル使用メモリ | 34,404 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 13:24:57 |
| 合計ジャッジ時間 | 1,215 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
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=1;
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!=len&&j+1-i>ans)ans=j-i+1;}
}
}
printf("%d\n",ans);
return 0;
}
184