# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
19789 |
2016-02-25T05:40:02 Z |
xhae |
창문 (kriii4_C) |
C++14 |
|
0 ms |
1084 KB |
#include <cstdio>
const long long MOD = 1000000007;
long long inv(long long tar) {
long long ret = 1;
for(int i = 30; i >= 0; i--) {
ret = ret * ret % MOD;
if((1ll << i) & (MOD - 2)) ret = ret * tar % MOD;
}
return ret;
}
long long func(long long c, long long x) {
long long ret = (x * x % MOD * x % MOD * inv(3) % MOD * -1 + MOD) % MOD;
ret = (ret + x * x % MOD * c % MOD * inv(2) % MOD) % MOD;
ret = (ret + c * inv(2) % MOD * x % MOD + x * inv(3) % MOD) % MOD;
return ret;
}
int main(void) {
long long h, w;
scanf("%lld %lld", &h, &w);
h %= MOD;
w %= MOD;
long long xsum = func(w, w);
long long ysum = func(h, h);
long long ans = xsum * ysum % MOD * 9 % MOD;
long long cases = w * (w + 1) % MOD * inv(2) % MOD;
cases = cases * (h * (h + 1) % MOD * inv(2) % MOD) % MOD;
ans = ans * inv(cases) % MOD;
printf("%lld\n", ans);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
0 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
0 ms |
1084 KB |
Output is correct |
12 |
Correct |
0 ms |
1084 KB |
Output is correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
0 ms |
1084 KB |
Output is correct |
16 |
Correct |
0 ms |
1084 KB |
Output is correct |
17 |
Correct |
0 ms |
1084 KB |
Output is correct |
18 |
Correct |
0 ms |
1084 KB |
Output is correct |
19 |
Correct |
0 ms |
1084 KB |
Output is correct |
20 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
0 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
0 ms |
1084 KB |
Output is correct |
12 |
Correct |
0 ms |
1084 KB |
Output is correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
0 ms |
1084 KB |
Output is correct |
16 |
Correct |
0 ms |
1084 KB |
Output is correct |
17 |
Correct |
0 ms |
1084 KB |
Output is correct |
18 |
Correct |
0 ms |
1084 KB |
Output is correct |
19 |
Correct |
0 ms |
1084 KB |
Output is correct |
20 |
Correct |
0 ms |
1084 KB |
Output is correct |
21 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |