結果

問題 No.1049 Zero (Exhaust)
ユーザー kotatsugamekotatsugame
提出日時 2020-05-08 21:46:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 229 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 63,756 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 00:24:43
合計ジャッジ時間 1,422 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=1e9+7;
long P;
int K;
main()
{
	cin>>P>>K;
	long t=1,a=0;
	for(;K--;)
	{
		long nt=(t*(P+1)+a*2)%mod;
		long na=(t*(P-1)+a*(2*P-2))%mod;
		t=nt;
		a=na;
	}
	cout<<t<<endl;
}
0