Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  dima
  4. //
  5. //  Created by Irina Korneeva on 23/05/2019.
  6. //  Copyright © 2019 Irina Korneeva. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <vector>
  11. using namespace std;
  12. int main(int argc, const char * argv[]) {
  13.     int n;
  14.     cin >> n;
  15.     long long ans = 0;
  16.     long long mod = 1000000007;
  17.     vector<long long> data(101, 0);
  18.     long long res = 1;
  19.     data[0] = res;
  20.     for(int i = 1; i <= 100; i++) {
  21.         res = (res * 2) % mod;
  22.         data[i] = res;
  23.     }
  24.     long long a = 1;
  25.     long long b = 2;
  26.     int x, y;
  27.  
  28.     cin >> x;
  29.     a = (a * data[x]) % mod;
  30.     for(int i = 2; i < n + 1; i++) {
  31.         cin >> y;
  32.         b = (b * data[y]) % mod;
  33.         long long r = b;
  34.         b = (a + b) % mod;
  35.         a = r;
  36.     }
  37.     cout << b;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement