# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975000 | vjudge1 | Trol (COCI19_trol) | C++17 | 1 ms | 348 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>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define all(a) a.begin(), a.end()
int main() {
fast
int A[] = {0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9};
ll q, l, r;
cin>>q;
rep(i, q){
cin>>l>>r;
int start_num = l%9;
ll multiple = (r-l+1)/9;
ll mod = (r-l+1)%9;
ll ans = 45*multiple;
for(int j = start_num, k = 0 ; k < mod ; k++, j++){
ans+=A[j];
}
cout<<ans<<"\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |