結果

問題 No.464 PPAP
コンテスト
ユーザー 👑 tails
提出日時 2016-12-15 22:29:25
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 408 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 262 ms
コンパイル使用メモリ 39,108 KB
最終ジャッジ日時 2026-02-23 23:50:15
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 TLE * 1 -- * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | a[5010];b[5010];
      | ^
main.c:2:9: warning: data definition has no type or storage class
    2 | a[5010];b[5010];
      |         ^
main.c: In function 'main':
main.c:14:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   14 |         l=strlen(s);
      |           ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
  +++ |+#include <string.h>
    1 | char s[5010];
main.c:34:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   34 |         printf("%lld",r);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | char s[5010];
/usr/bin/ld: /tmp/cczfX3Jk.o: in function `main':
main.c:(.text.startup+0x18): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

char s[5010];
a[5010];b[5010];
long long r;

f(a,b){
	char*p=s+a;
	char*q=s+b;
	while(p<q&&*p==*q)++p,--q;
	return p>=q;
}

main(i,j,k,l,m){
	gets(s);
	l=strlen(s);
	for(i=0;i<l;++i){
		if(f(0,i)){
			for(j=i+1;j<l;++j){
				if(f(i+1,j)){
					++a[j];
				}
			}
		}
	}
	for(j=0;j<l;++j){
		if(f(j,l-1)){
			++b[j];
		}
	}
	m=0;
	for(i=0;i<l;++i){
		m+=a[i];
		r+=m*b[i+2];
	}
	printf("%lld",r);
	return 0;
}
0