結果

問題 No.464 PPAP
ユーザー YamyukiYamyuki
提出日時 2016-12-15 22:13:06
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 481 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 22,144 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-05-07 15:02:30
合計ジャッジ時間 3,741 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
13,880 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 0 ms
6,940 KB
testcase_03 AC 0 ms
6,944 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 0 ms
6,944 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%s",str);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>

int check(char *str,int s,int e){
	int w,i;
	w=(e-s+1)/2;
	for(i=0;i<w;i++){
		if(str[s+i]!=str[e-i]) return 0;
	}
	return 1;
}

int main(){
	char str[5001];
	int n,i,j,k;
	long c=0;
	scanf("%s",str);
	n=strlen(str);
	for(i=0;i<n-3;i++){
		if(check(str,0,i)){
			for(j=i+1;j<n-2;j++){
				if(check(str,i+1,j)){
					for(k=n-1;k>j+1;k--){
						if(check(str,k,n-1)){
							c++;
						}
					}
				}
			}
		}
	}
	printf("%ld\n",c);
	return 0;
}
0