Submission #198380

# Submission time Handle Problem Language Result Execution time Memory
198380 2020-01-25T17:52:08 Z grobar Trol (COCI19_trol) C++14
30 / 50
10 ms 376 KB
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin>>t;
    long long int a,b;
    while(t>0)
    {
        long long int sum=0;
        cin>>a>>b;
        long long int dif=b-a;
        int pm=a%9;
        sum=(dif/9)*45;
        for(int j=b;j>=(b-dif%9);j--)
        {
            if(j%9==0)
            {
                sum=sum+9;
            }
            sum=sum+(j%9);
        }
        cout<<sum<<endl;
        t--;
    }
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:15:13: warning: unused variable 'pm' [-Wunused-variable]
         int pm=a%9;
             ^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 4 ms 248 KB Output is correct
3 Incorrect 10 ms 376 KB Output isn't correct
4 Correct 0 ms 232 KB Output is correct
5 Incorrect 3 ms 376 KB Output isn't correct