結果
問題 |
No.52 よくある文字列の問題
|
ユーザー |
![]() |
提出日時 | 2014-10-29 00:08:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 418 ms |
コンパイル使用メモリ | 39,728 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-30 13:25:35 |
合計ジャッジ時間 | 1,091 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:26: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | char s[101];scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#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; }