結果

問題 No.52 よくある文字列の問題
ユーザー akakimidoriakakimidori
提出日時 2017-06-20 21:56:24
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 06:28:10
合計ジャッジ時間 904 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 0 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 0 ms
6,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 0 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |   ^~~~~~~~~~~~~

ソースコード

diff #

#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;
}
0