From ffffd5fcd174a316c3d5680b112b9d6aba80d137 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Fri, 13 Aug 2021 18:38:30 +0800 Subject: [PATCH] =?UTF-8?q?48570=20=E3=80=90LGR-089=E3=80=91=E6=B4=9B?= =?UTF-8?q?=E8=B0=B7=208=20=E6=9C=88=E6=9C=88=E8=B5=9B=20II?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit T166874: R55803919 --- Luogu/contest/48570/T166874/T166874.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Luogu/contest/48570/T166874/T166874.cpp diff --git a/Luogu/contest/48570/T166874/T166874.cpp b/Luogu/contest/48570/T166874/T166874.cpp new file mode 100644 index 00000000..2588cfdc --- /dev/null +++ b/Luogu/contest/48570/T166874/T166874.cpp @@ -0,0 +1,17 @@ +#include + +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; +}