結果

問題 No.1552 Simple Dice Game
ユーザー kotatsugame
提出日時 2021-06-18 22:37:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 433 ms / 2,500 ms
コード長 419 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 68,096 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-06-22 21:01:39
合計ジャッジ時間 6,905 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
long N;
int M;
mint L[5<<17],R[5<<17];
main()
{
	cin>>N>>M;
	L[0]=0;
	mint ans=0,pre=0;
	for(int i=1;i<=M;i++)
	{
		L[i]=mint(i).pow(N)*N*(i+1)/2;
		mint tmp=L[i];
		L[i]-=pre;
		pre=tmp;
		ans+=i*L[i];
	}
	for(int i=1;i<=M;i++)
	{
		int j=M-i+1;
		ans-=mint(j).pow(N)*N*(M-mint(j-1)/2);
	}
	cout<<ans.val()<<endl;
}
0