結果

問題 No.464 PPAP
コンテスト
ユーザー くれちー
提出日時 2016-12-15 23:02:25
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 588 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 199 ms
コンパイル使用メモリ 37,688 KB
最終ジャッジ日時 2026-02-23 23:50:27
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int iskaibun(char *s, int f, int t) {
	int i;
	for (i = 0; i <= t - f; 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++) {
		for (p2 = 1; p2 <= len - 3; p2++) {
			for (a = 1; a <= len - 3; a++) {
				if (len - (p1 + p2 + a) < 1) continue;
				if (iskaibun(s, 0, p1 - 1) && 
					iskaibun(s, p1, p1 + p2 - 1) && 
					iskaibun(s, p1 + p2 + a, len - 1)) cnt++;
			}
		}
	}

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