# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
18997 | | kriii | 제비 (kriii4_W) | C++14 | | 2 ms | 1084 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
const long long mod = 1000000007;
long long pow(long long a, long long p)
{
long long r = 1;
while (p){
if (p & 1) r = r * a % mod;
a = a * a % mod;
p /= 2;
}
return r;
}
long long inv(long long a)
{
return pow(a,mod-2);
}
int main()
{
int T; scanf ("%d",&T); while (T--){
long long r,g,b,k;
scanf ("%lld %lld %lld %lld",&r,&g,&b,&k);
long long ans = (r + k + k * g % mod * inv(b)) % mod;
ans = (ans + mod - r * pow(b*inv(b+1)%mod,k) % mod) % mod;
printf ("%lld\n",ans);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |