結果
問題 |
No.52 よくある文字列の問題
|
ユーザー |
![]() |
提出日時 | 2017-06-20 21:56:24 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 373 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 08:07:54 |
合計ジャッジ時間 | 845 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 4 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:17:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%s",s); | ^~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> int calc(char *s,int l,int r){ if(l>=r) return 1; int res=calc(s,l+1,r)+calc(s,l,r-1);; if(s[l]==s[r]){ res-=calc(s,l+1,r-1); } return res; } void run(void){ char s[11]; scanf("%s",s); int len=0; while(s[len]!='\0') len++; printf("%d\n",calc(s,0,len-1)); return; } int main(void){ run(); return 0; }