# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
485826 | groupATSU | Trol (COCI19_trol) | C++14 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |