Submission #20205

#TimeUsernameProblemLanguageResultExecution timeMemory
20205veckalΩ (kriii4_P3)C++14
0 / 100
491 ms512 KiB
#include <stdio.h> const int MOD = 1000000007; typedef long long ll; ll pow(ll base, int exp) { if (exp == 1) return base; ll ret = pow(base, exp>>1); ret = ret * ret % MOD; if (exp&1) ret = ret * base % MOD; return ret; } ll inv(ll base) { return pow(base, MOD-2); } int p, q, n, k; int main() { scanf("%d%d%d%d", &p, &q, &n, &k); p = q * inv(p) % MOD; int m = p * inv((1+MOD-p)%MOD); int ans = inv((1-pow(m, n)+MOD)%MOD) * ((1-pow(m, k)+MOD)%MOD) % MOD; printf("%d\n", ans); return 0; }

Compilation message (stderr)

P3.cpp: In function 'int main()':
P3.cpp:20:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d%d", &p, &q, &n, &k);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...