結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
publfl
|
| 提出日時 | 2021-07-22 22:02:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 437 bytes |
| コンパイル時間 | 458 ms |
| コンパイル使用メモリ | 32,256 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-17 17:51:38 |
| 合計ジャッジ時間 | 1,329 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <stdio.h>
#include <string.h>
char x[1000010];
int main()
{
scanf("%s",x+1);
int a = strlen(x+1);
int control = 0;
for(int i=1;i<=a;i++) if(x[i]!=x[a-i+1]) control = 1;
if(control==1) printf("%d",a);
else
{
control = 0;
for(int i=1;i<a;i++) if(x[i]!=x[i+1]) control = 1;
if(control==0)
{
if(a%2==0) printf("0");
else printf("-1");
}
else
{
if(a==3) printf("-1");
else printf("%d",a-2);
}
}
}
publfl