結果

問題 No.3172 三角関数べき乗のフーリエ級数展開
ユーザー pengin_2000
提出日時 2025-06-06 22:08:08
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 977 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-06 22:08:11
合計ジャッジ時間 2,756 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:21:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%lld", &n);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	for (; n > 0; n /= 2, a = a * a % p)
		if (n % 2 > 0)
			res = res * a % p;
	return res;
}
long long int fact[200005];
long long int comb(long long int n, long long int r, long long int p)
{
	long long int res = fact[n];
	res = res * modpow(fact[r], p - 2, p) % p;
	res = res * modpow(fact[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int i;
	const long long int p = 998244353;
	fact[0] = 1;
	for (i = 1; i <= n; i++)
		fact[i] = fact[i - 1] * i % p;
	for (i = 0; i < n; i++)
	{
		if (n % 2 != i % 2)
			printf("0 ");
		else if (i > 0)
			printf("%lld ", comb(n, (n - i) / 2, p) * 2 % p);
		else
			printf("%lld ", comb(n, n / 2, p));
	}
	if (n > 0)
		printf("2\n");
	else
		printf("1\n");
	return 0;
}
0