답안 #976657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976657 2024-05-07T00:38:44 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
#define nah_id_win ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi first
#define se second
using namespace std;

int main(){
    nah_id_win;
    ll arr[10]; arr[0]=0;
    for(int i=1; i<=9; i++){
        arr[i]=i;
        arr[i]+=arr[i-1];
    }

    ll q; cin >> q;
    while(q--){
        ll l, r; cin >> l >> r;
        ll range, n, sum=0, suff;
        n=l/9;
        suff=arr[(l-(9*n))-1];
        n=r/9;
        sum=arr[r-(9*n)];
        range=r/9-l/9;
        sum+=arr[9]*range;
        cout << sum-suff << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct