-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJulyLong7.cpp
More file actions
43 lines (39 loc) · 848 Bytes
/
JulyLong7.cpp
File metadata and controls
43 lines (39 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
#define ll long long int
#define doit() int t; cin>>t;while(t--)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
template<class type>
type gcd(type a, type b) {return (b==0)?a:gcd(b,a%b);}
int main()
{
// doit()
// {
int n;
int mod = 786433;
cin>>n;
ll a[n+1];
for(int i=0;i<=n;i++)
cin>>a[i];
int query;cin>>query;
while(query--){
ll q;cin>>q;
ll ans= 0,pows = 1;
for(int i=0;i<=n;i++){
ans += (a[i]*pows);
ans%=mod;
pows = (q*pows)%mod;
}
cout<<ans<<endl;
}
// }
return 0;
}