結果
問題 |
No.797 Noelちゃんとピラミッド
|
ユーザー |
|
提出日時 | 2019-03-16 00:08:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,681 bytes |
コンパイル時間 | 2,077 ms |
コンパイル使用メモリ | 192,632 KB |
最終ジャッジ日時 | 2025-01-06 22:26:57 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 54 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | #define Scd(x) scanf("%d", &x) | ~~~~~^~~~~~~~~~ main.cpp:57:5: note: in expansion of macro ‘Scd’ 57 | Scd( N ); | ^~~ main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | #define Scll(x) scanf("%llu", &x) | ~~~~~^~~~~~~~~~~~ main.cpp:60:9: note: in expansion of macro ‘Scll’ 60 | Scll( a[i] ); | ^~~~
ソースコード
#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; }