제출 #1124470

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

using namespace std;
#define int long long
int t;
main()
{
    cin>>t;
    while(t--){
        int l,r;
        cin>>l>>r;
        int res=(r-l+1);
        int tmp=res%9;
        res=((res/9)*45);
        int x=0;
        while(l>9){
            while(l){
                x+=(l%10);
                l/=10;
            }
            l=x;
            x=0;
        }
        x=l;
        while(tmp){
            tmp--;
            res+=x;
            x++;
            if(x>9)x=1;
        }
        cout<<res<<"\n";
    }
    return 0;
}

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

trol.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...