Submission #19966

#TimeUsernameProblemLanguageResultExecution timeMemory
19966algoshipda창문 (kriii4_C)C++14
3 / 100
0 ms1720 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lld; const int MOD = 1e9 + 7; const int MN = 1e6 + 10; int fpow(int n, int k) { if(k == 0) return 1; if(k % 2){ return 1ll * n * fpow(n, k - 1) % MOD; } int h = fpow(n, k / 2); return 1ll * h * h % MOD; } inline int inv(int n) { return 1ll * fpow(n, MOD - 2) % MOD; } inline void mult(int& a, int b) { a = 1ll * a * b % MOD; } inline int mult2(int a, int b) { return 1ll * a * b % MOD; } inline void sub(int& a, int b) { a = ((a - b) % MOD + MOD) % MOD; } inline int rational(int a, int b) { return 1ll * a * inv(b) % MOD; } inline void add(int &a, int b) { a = ((a + b) % MOD + MOD) % MOD; } inline int add2(int a, int b) { return ((a + b) % MOD + MOD) % MOD; } int nCr(int n, int r) { int ans = 1; for(int i = 1; i <= r; ++i){ mult(ans, inv(i)); mult(ans, n - i + 1); } return ans; } int main() { lld h, w; cin >> h >> w; h %= MOD; w %= MOD; int b = mult2(mult2(mult2(h,h+1), mult2(w,w+1)), inv(4)); int hh = h; mult(hh, h+1); mult(hh, h+2); mult(hh, inv(6)); int ww = w; mult(ww, w+1); mult(ww, w+2); mult(ww, inv(6)); int a = mult2(hh,ww); mult(a, 9); cout << mult2(a, inv(b)) << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...