Submission #704767

# Submission time Handle Problem Language Result Execution time Memory
704767 2023-03-03T01:23:07 Z willychan Trol (COCI19_trol) C++14
50 / 50
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds

ll get(ll b){
	ll g = b%9;
	ll k = (g*g+g)/2;
	k+=45LL*(b/9);
	return k;
}

void solve(){
	ll l,r;cin>>l>>r;
	cout<<get(r)-get(l-1)<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t;cin>>t;
	while(t--){
		solve();
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct