結果

問題 No.1681 +-*
ユーザー kotatsugame
提出日時 2021-09-17 21:37:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 68,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 20:01:15
合計ジャッジ時間 2,407 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint1000000007;
int N;
int A[2<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	mint X=0,Y=A[0];
	for(int i=1;i<N;i++)
	{
		X=X*3+2*Y;
		Y*=A[i];
	}
	cout<<(X+Y).val()<<endl;
}
0