# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1266437 | canhnam357 | Trol (COCI19_trol) | C++20 | 1 ms | 324 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int q;
cin >> q;
while (q--) {
long long l, r;
cin >> l >> r;
auto f = [&](long long n) {
int ans = 0;
while (n % 9) {
ans += n % 9;
n--;
}
return ans + n * 5;
};
cout << f(r) - f(l - 1) << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |