# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
259161 |
2020-08-07T09:14:26 Z |
lani1akea |
Trol (COCI19_trol) |
C++17 |
|
1000 ms |
384 KB |
#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;
a += (9 - a % 9) + 1;
}
for (int i = a + 9; i <= b; i += 9) {
ans += 45;
a = i;
}
for (int i = a; i <= b; ++i)
ans += (i % 9 ? i % 9 : 9) ;
cout << ans << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
263 ms |
384 KB |
Output isn't correct |
5 |
Execution timed out |
1076 ms |
384 KB |
Time limit exceeded |