結果
問題 | No.1081 和の和 |
ユーザー |
|
提出日時 | 2020-06-22 01:38:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,425 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 168,972 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 18:32:48 |
合計ジャッジ時間 | 2,351 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
ソースコード
#include<bits/stdc++.h>using namespace std;/******* All Required define Pre-Processors and typedef Constants *******/#define all(cont) cont.begin(), cont.end()#define rall(cont) cont.end(), cont.begin()#define rep(i,n) for(int i=0; i<(n); ++i)#define rep1(i,n) for(int i=1; i<=(n); ++i)#define Dcout(a) cout << setprecision(20) << a << endl#define MP make_pair#define PB push_back#define EPS 1e-9#define PI 3.1415926535897932384626433832795#define MOD 1000000007using ll = long long;using PAIR = pair<int, int>;using Graph = vector<vector<int>>;//const ll INF = (1LL << 60);//const double pi=acos(-1.0);#define debug cout << "line : " << __LINE__ << " debug" << endl/****** Template of some basic operations *****/template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }/**************************************//******** User-defined Function *******//**************************************//********** Main() function **********/int main(){cin.tie(0);ios::sync_with_stdio(false);int n; cin >> n;vector<ll> a(n);rep(i,n) cin >> a[i];int d = n-1;for(int i=n-1; i>0; --i){for(int j=0; j<i; ++j){a[j] = (a[j] + a[j+1]) % MOD ;}}cout << a[0] << endl;return 0;}/******** Main() Ends Here *************/