結果
| 問題 | No.797 Noelちゃんとピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-16 00:08:17 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,681 bytes |
| 記録 | |
| コンパイル時間 | 1,899 ms |
| コンパイル使用メモリ | 209,152 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-06-07 07:37:58 |
| 合計ジャッジ時間 | 5,400 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 54 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2
// }}} 1
ll mod = 1000000007;
// PowMod( base, index, modulo) return base ** index % modulo {{{
// PowMod = base ** index % mod ( natural numbers )
long long unsigned int PowMod( long long unsigned int base, long long unsigned int index, long long unsigned int modulo = mod ){
if( index == 0 ) return 1;
// O( log(index) )
if( index % 2 ){
return base * PowMod(base, index - 1, modulo) % modulo;
}else{
long long unsigned int Phalf = index / 2;
long long unsigned int half = PowMod(base, Phalf, modulo);
return half * half % modulo;
}
}
// }}}
int main() {
int N;
Scd( N );
ll a[100023];
Rep(i,N){
Scll( a[i] );
}
ll c;
// (N-1)Ci
c = 1;
ll ans = 0;
Rep(i,N){
ans += a[i]*c;
ans %= mod;
c = c * (N-i-1) * PowMod( i+1, mod-2 ) % mod;
}
printf ("%lld\n", ans );
return 0;
}