結果
| 問題 | No.52 よくある文字列の問題 |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2014-10-29 00:08:20 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 606 bytes |
| 記録 | |
| コンパイル時間 | 283 ms |
| コンパイル使用メモリ | 60,028 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-04 03:08:43 |
| 合計ジャッジ時間 | 1,160 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 3 |
ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
//namaega 184
int ans=0;
int dfs(char *s,char *m,int len,int n,int fst,int lst){
if(n==len){
ans++;
return 0;
}
m[n]=s[fst];
dfs(s,m,len,n+1,fst+1,lst);
if(s[fst]!=s[lst]){
m[n]=s[lst];
dfs(s,m,len,n+1,fst,lst-1);
}
return 0;
}
int main(){
char s[101];scanf("%s",s);
int len=strlen(s);
int fst=0,lst=len-1;
if(len==1){
printf("1\n");
return 0;
}
char m[101]={};
dfs(s,m,len,0,fst,lst);
printf("%d\n",ans);
return 0;
}
184