# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
379414 |
2021-03-18T07:39:52 Z |
benedict0724 |
제비 (kriii4_W) |
C++17 |
|
3 ms |
492 KB |
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll pow(ll x, ll y){
int k = 0; ll temp = x, ans = 1;
while((1LL << k) <= y)
{
if((1LL << k) & y){
ans *= temp;
ans %= mod;
}
temp *= temp;
temp %= mod;
k++;
}
return ans;
}
ll inv(ll x) { return pow(x, mod - 2); }
void solve()
{
ll R, G, B, K; cin >> R >> G >> B >> K;
ll ans = (B+G)*K; ans %= mod;
ans *= inv(B); ans %= mod;
ll ans2 = R * inv(pow(1+B, K)); ans2 %= mod;
ll ans3 = pow(1+B, K) - pow(B, K); ans3 %= mod;
ans2 *= ans3; ans2 %= mod;
ans += ans2; ans %= mod;
if(ans < 0) ans += mod;
cout << ans << "\n";
}
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int t; cin >> t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
3 |
Correct |
2 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
2 ms |
364 KB |
Output is correct |
8 |
Correct |
3 ms |
364 KB |
Output is correct |
9 |
Correct |
2 ms |
364 KB |
Output is correct |
10 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
364 KB |
Output is correct |
4 |
Correct |
2 ms |
364 KB |
Output is correct |
5 |
Correct |
2 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
364 KB |
Output is correct |
7 |
Correct |
2 ms |
492 KB |
Output is correct |
8 |
Correct |
2 ms |
364 KB |
Output is correct |
9 |
Correct |
2 ms |
364 KB |
Output is correct |
10 |
Correct |
2 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
2 ms |
364 KB |
Output is correct |
13 |
Correct |
2 ms |
492 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
364 KB |
Output is correct |
16 |
Correct |
2 ms |
364 KB |
Output is correct |
17 |
Correct |
2 ms |
364 KB |
Output is correct |
18 |
Correct |
2 ms |
364 KB |
Output is correct |
19 |
Correct |
2 ms |
364 KB |
Output is correct |
20 |
Correct |
2 ms |
364 KB |
Output is correct |