mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 06:18:48 +00:00
48570 【LGR-089】洛谷 8 月月赛 II
T166874: R55803919
This commit is contained in:
parent
2fa8305968
commit
ffffd5fcd1
17
Luogu/contest/48570/T166874/T166874.cpp
Normal file
17
Luogu/contest/48570/T166874/T166874.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
const long long mod = 1e9 + 7;
|
||||||
|
long long t, n, k, k1, k2;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cin >> t;
|
||||||
|
while (t--) {
|
||||||
|
cin >> n >> k;
|
||||||
|
k1 = k + 1 >> 1;
|
||||||
|
k2 = k >> 1;
|
||||||
|
cout << 1ll * (((((n * (n + 1)) / 2 % mod * k1 % mod) - (((k1 - 1) * k1) / 2 % mod) % mod) + ((((n - 1) * n) / 2 % mod * k2 % mod) - ((k2 - 1) * k2) / 2) % mod) % mod + mod) % mod << endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user