Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // dima
- //
- // Created by Irina Korneeva on 23/05/2019.
- // Copyright © 2019 Irina Korneeva. All rights reserved.
- //
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(int argc, const char * argv[]) {
- int n;
- cin >> n;
- long long ans = 0;
- long long mod = 1000000007;
- vector<long long> data(101, 0);
- long long res = 1;
- data[0] = res;
- for(int i = 1; i <= 100; i++) {
- res = (res * 2) % mod;
- data[i] = res;
- }
- long long a = 1;
- long long b = 2;
- int x, y;
- cin >> x;
- a = (a * data[x]) % mod;
- for(int i = 2; i < n + 1; i++) {
- cin >> y;
- b = (b * data[y]) % mod;
- long long r = b;
- b = (a + b) % mod;
- a = r;
- }
- cout << b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement