結果

問題 No.464 PPAP
ユーザー くれちーくれちー
提出日時 2016-12-15 23:13:15
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 617 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 22,144 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-05-07 15:16:34
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,752 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 0 ms
6,940 KB
testcase_03 AC 1 ms
6,948 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 0 ms
6,940 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:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

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

int iskaibun(char *s, int f, int t) {
	int i;
	for (i = 0; i <= (t - f - 1) / 2; i++) {
		if (s[f + i] != s[t - i]) return 0;
	}
	return 1;
}

int main() {
	char s[5001];
	scanf("%s", s);

	int len = strlen(s);
	int p1, p2, a, cnt = 0;

	for (p1 = 1; p1 <= len - 3; p1++) {
		if (!iskaibun(s, 0, p1 - 1)) continue;
		for (p2 = 1; p2 <= len - 3; p2++) {
			if (!iskaibun(s, p1, p1 + p2 - 1)) continue;
			for (a = 1; a <= len - 3; a++) {
				if (len - (p1 + p2 + a) < 1) continue;
				if (iskaibun(s, p1 + p2 + a, len - 1)) cnt++;
			}
		}
	}

	printf("%d\n", cnt);
	return 0;
}
0