# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288342 | 2020-09-01T12:27:27 Z | Lawliet | Trol (COCI19_trol) | C++17 | 1 ms | 288 KB |
#include <bits/stdc++.h> using namespace std; typedef long long int lli; lli getValue(lli k) { if( k%9 != 0 ) return k%9; return 9; } int main() { int n; scanf("%d",&n); while( n-- ) { lli L, R; scanf("%lld %lld",&L,&R); lli ans = 0; while( L%9 != 1 && L <= R ) ans += getValue( L++ ); while( R%9 != 0 && L <= R ) ans += getValue( R-- ); lli sz = (R - L + 1)/9; ans += sz*45; printf("%lld\n",ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 288 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |