結果
| 問題 |
No.464 PPAP
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-12-15 23:02:25 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-11-30 08:54:58 |
| 合計ジャッジ時間 | 32,095 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 TLE * 10 |
コンパイルメッセージ
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);
| ^~~~~~~~~~~~~~
ソースコード
#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;
}
くれちー