# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1192152 | SmuggingSpun | Trol (COCI19_trol) | C++20 | 1 ms | 328 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
typedef long long ll;
ll f(ll n){
return 45LL * (n / 9LL) + (((n % 9LL) * (n % 9LL + 1)) >> 1LL);
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int _t;
cin >> _t;
for(int _ = 0; _ < _t; _++){
ll l, r;
cin >> l >> r;
cout << f(r) - f(l - 1) << "\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |