Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <bits/stdc++.h>
- //%lld
- typedef long long ll;
- #define si(a) scanf("%d", &a)
- #define sii(a, b) scanf("%d%d", &a, &b)
- #define pi(a) printf("%d\n", a)
- using namespace std;
- ll vetor[10000000];
- int main(){
- //freopen("in.txt", "r", stdin);
- //freopen("out.txt", "w", stdout);
- int t, d, k;
- int e;
- cin>>t;
- while(t--){
- int p = 0;
- int temp = 0;
- ll saida = 0;
- cin>>e;
- for(int i = 0;i<=e;i++)cin>>vetor[i];
- cin>>d>>k;
- for(int i = 0;;i++){
- p+=d;
- temp+=p;
- if(temp>=k){
- for(int j = 0;j<=e;j++){
- saida+=vetor[j]*pow(i, j);
- }
- break;
- }
- }
- cout<<saida<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment