結果
| 問題 |
No.1081 和の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-19 23:57:32 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,625 bytes |
| コンパイル時間 | 12,973 ms |
| コンパイル使用メモリ | 296,484 KB |
| 最終ジャッジ日時 | 2025-01-11 08:14:34 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
ソースコード
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x),end(x)
#define forn(i, n) for (int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n - 1; i >= 0; --i)
const int N = 2e5 + 5, M = 1e9 + 7; // 998244353
const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};
const ll INF = 1e18 + 10LL;
const ld PI = 4.0 * atan((ld) 1.0), EPS = 1e-6;
const char nl = '\n';
template< typename T > inline T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template< typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) {a = min(a, b);}
template <class T> void ckmax(T& a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
string YN(bool x) { return x ? "YES" : "NO"; }
void solve(int tcn) {
int n;
cin >> n;
vector<int> a(n);
forn(i, n)
cin >> a[i];
while (a.size() > 1) {
vector<int> b(a.size() - 1);
forn(i, a.size() - 1) {
b[i] = a[i] + a[i + 1];
b[i] %= M;
}
a = b;
}
cout << a[0] % M << nl;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int t = 1; //cin >> t;
for (int i = 1; i <= t; ++i) {
solve(i);
}
return 0;
}