結果

問題 No.464 PPAP
ユーザー akakimidoriakakimidori
提出日時 2018-04-18 15:37:34
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 577 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 25,708 KB
実行使用メモリ 5,256 KB
最終ジャッジ日時 2023-09-09 11:22:17
合計ジャッジ時間 4,999 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int isPalindrome(char *s,int l,int r){
  int i=0;
  while(l+i<r-1-i){
    if(s[l+i]!=s[r-1-i]) return 0;
    i++;
  }
  return 1;
}

void run(void){
  char s[5001];
  scanf("%s",s);
  int n=0;
  while(s[n]!='\0') n++;

  int cnt=0;
  int i;
  for(i=1;i<n;i++){
    if(!isPalindrome(s,0,i)) continue;
    int j;
    for(j=i+1;j<n;j++){
      if(!isPalindrome(s,i,j)) continue;
      int k;
      for(k=n-1;k>j;k--){
	if(isPalindrome(s,k,n)) cnt++;
      }
    }
  }
  printf("%d\n",cnt);
  return;
}

int main(void){
  run();
  return 0;
}
0