제출 #249499

#제출 시각아이디문제언어결과실행 시간메모리
249499shafinalamTrol (COCI19_trol)C++14
50 / 50
1 ms256 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    int T;
    scanf("%d", &T);

    while(T--)
    {
        ll l, r;
        cin >> l >> r;
        ll sum = 0;
        while(l<=r && (l%9)!=1)
        {
            ll x = l%9;
            if(x==0) x = 9;
            sum+=x;
            l++;
        }
        while(r>=l && (r%9)!=0)
        {
            sum+=(r%9);
            r--;
        }
        if(r-l+1>0)
        {
            ll len = (r-l+1)/9;
            sum+=(len*45);
        }
        cout << sum << '\n';
    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

trol.cpp: In function 'int main()':
trol.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &T);
     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...