QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#232106 | #4385. Random | rgnerdplayer | AC ✓ | 15ms | 3580kb | C++20 | 441b | 2023-10-29 21:32:26 | 2023-10-29 21:32:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
constexpr int P = 1e9 + 7;
int n, m;
cin >> n >> m;
int ans = 1LL * (n - m) * (P + 1) / 2 % P;
cout << ans << '\n';
};
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 15ms
memory: 3580kb
input:
100000 42 30 6335 1161 19170 15725 11479 6401 26963 24465 5706 5322 23282 16828 9962 492 2996 2955 4828 609 32392 14605 3903 154 293 77 17422 1295 19719 177 5448 5383 14772 11539 1870 1213 25668 632 17036 9895 28704 23812 31323 30334 17674 4665 15142 7712 28254 6869 25548 2097 32663 95 20038 12860 8...
output:
6 2587 500001726 2539 1249 192 3227 4735 500000024 500002113 500008897 500001878 108 500008067 9771 500000036 500001620 500000332 12518 500003574 2446 500000498 500006508 3715 500010696 500011729 16284 3589 3853 500013379 500004644 10174 119 49 500007944 500001824 500004584 4510 500006963 500010426 ...
result:
ok 100000 lines