Submission #977175

# Submission time Handle Problem Language Result Execution time Memory
977175 2024-05-07T13:02:37 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n' 
#define debug(x) cerr << #x << " --> " << x << endl;
#define shine ios_base::sync_with_stdio(false), cin.tie(nullptr);
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    shine
    ll q;
    cin >> q;
    while(q--){
        ll l, r;
        cin >> l >> r;
        l--;
        ll cnt1 = r / 9, cnt2 = l / 9, mod1 = r % 9, mod2 = l % 9;
        ll ans = (cnt1 - cnt2 + ((mod1*(mod1+1)-(mod2*(mod2+1))) >> 1));
        cout << ans << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct