-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path927.cpp
More file actions
executable file
·46 lines (39 loc) · 843 Bytes
/
927.cpp
File metadata and controls
executable file
·46 lines (39 loc) · 843 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
44
45
46
#include <bits/stdc++.h>
using namespace std;
int main()
{
int c;
cin>>c;
while(c--)
{
int i=0;
char temp;
vector<int> arr(24,0);
do {
scanf("%d%c", &arr[i], &temp);
i++;
} while(temp != '\n');
int d,k;
cin>>d>>k;
long long check[1420]={0};
for(int i=1; i<1420; i++)check[i]=i*(i+1)*d/2;
long long sum=0;
long long pp;
for(int i=1; i<1420; i++)
{
if(k<=check[i]){
pp=i;
break;
}
}
cout<<pp<<endl;
long long x=1;
long long ai=0;
for(int i=1; i<24; i++)
{
ai=ai+(arr[i]*x);
x=x*pp;
}
cout<<ai<<endl;
}
}