結果
| 問題 |
No.797 Noelちゃんとピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-15 22:05:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 143 ms / 2,000 ms |
| コード長 | 260 bytes |
| コンパイル時間 | 554 ms |
| コンパイル使用メモリ | 65,992 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 21:00:50 |
| 合計ジャッジ時間 | 6,795 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 60 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
long m=1e9+7,s;
long p(long a,long b){return b?p(a*a%m,b/2)*(b%2?a:1)%m:1;}
main()
{
int n;cin>>n;
long x=1;
for(int i=0;i<n;i++)
{
long a;cin>>a;
s=(s+a*x%m)%m;
x=x*(n-i-1)%m*p(i+1,m-2)%m;
}
cout<<s<<endl;
}