# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
259159 | lani1akea | Trol (COCI19_trol) | C++17 | 1088 ms | 121548 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define F first
#define S second
#define int long long
#define pb push_back
#define endl '\n'
#define rep(x) cout << #x << "= " << x << endl
#define OK cout << "OK\n"
using namespace std;
const int MOD = 1e9 + 7;
const int N = 510;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int T;
cin >> T;
while(T--) {
int a, b;
cin >> a >> b;
int ans = 0;
if ( a + (9 - a % 9) + 1 <= b) {
ans += 45 - (9 - a % 9) * (10 - a % 9) / 2;
rep(ans);
OK;
a += (9 - a % 9) + 1;
}
for (int i = a + 9; i <= b; i += 9) {
ans += 45;
OK;
a = i;
}
for (int i = a; i <= b; ++i)
ans += (i % 9 ? i % 9 : 9) ;
cout << ans << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |