# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1257377 | symbioter | Trol (COCI19_trol) | C++20 | 0 ms | 324 KiB |
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
using namespace std;
ll f(ll x){
ll ret = (x/9) * 45;
for(int i = 1; i <= x % 9 ;i++) ret += i;
return ret;
}
void work(){
ll l, r; cin >> l >> r;
cout << f(r) - f(l-1) << endl;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int t = 1; cin >> t;
while(t--)work();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |