Submission #485826

# Submission time Handle Problem Language Result Execution time Memory
485826 2021-11-09T13:23:16 Z groupATSU Trol (COCI19_trol) C++14
50 / 50
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e9;
const int maxn=100;
const ll mod=998244353;
int dp[maxn][maxn];
void solve(){
	ll l,r;
	cin>>l>>r;
	l--;
	int c=r%9;
	int c1=l%9;
	ll x1=(r/9)*45+(c*(c+1))/2;
	ll x2=(l/9)*45+(c1*(c1+1))/2;
	//cout<<x2<<" "<<x1<<endl;
	cout<<x1-x2;
	
}

int main(){
	//ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int t=1;
   	cin>>t;
    while(t--){
        solve();
        cout<<'\n';
    }


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