結果
| 問題 |
No.797 Noelちゃんとピラミッド
|
| コンテスト | |
| ユーザー |
hato3617
|
| 提出日時 | 2019-03-15 22:57:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 66,600 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 21:25:28 |
| 合計ジャッジ時間 | 12,553 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 1 WA * 2 RE * 57 |
ソースコード
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<cstdio>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> A(n);
int i;
for ( i = 0; i < n; i++) {
cin >> A[i];
}
long long ans = 0;
for ( i = 0; i < n; i++) {
int a = 1;
int b = 1;
int c = 1;
for (int j = n-1; j > 0; j--) {
a = a * j;
}
for (int j = n-1-i; j > 0; j--) {
b = b* j;
}
if (i == 0) {
c = 1;
}
else {
for (int j = i; j > 0; j--) {
c = c * j;
}
}
int d = b * c;
ans += (long long)A[i] * (long long)a / (long long)d;
}
ans = ans % 1000000007;
cout << ans << endl;
return 0;
}
hato3617