Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r",stdin);
- #endif // ONLINE_JUDGE
- int n,m,q,mod=30000000;
- cin>>n>>m>>q;
- int arm[n],b[q];
- for(int i=0;i<m;i++)cin>>arm[i];
- for(int i=m;i<n;i++)
- {
- arm[i]=(arm[i-m]+arm[i-m+1])%mod;
- }
- sort(arm,arm+n);
- for(int i=0;i<q;i++)
- {
- cin>>b[i];
- cout<<arm[b[i]-1]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement