# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
470234 |
2021-09-03T09:57:19 Z |
Karabasan |
Trol (COCI19_trol) |
C++17 |
|
2 ms |
296 KB |
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forcin for(int i=0;i<n;i++) scanf("%d",&dizi[i]);
#define forcout for(int i=0;i<n;i++) printf("%d ",dizi[i]);
#define ll long long
using namespace std;
int q;
vector<ll> ret;
ll get(ll x) {
ll b = x / 9;
ll res = 45 * b;
for (ll i = 0; i <= x%9; i++) res += i;
return res;
}
int main() {
cin >> q;
for (int i = 0; i < q; i++) {
ll l, r; cin >> l >> r;
ret.push_back(get(r)-get(l-1));
}
for (ll z : ret) cout << z << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
2 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |