Submission #974835

# Submission time Handle Problem Language Result Execution time Memory
974835 2024-05-04T00:30:52 Z vjudge1 Trol (COCI19_trol) C++
0 / 50
1 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
long long f(long long l,long long r){
    long long ret=0;
    long long awal;
    for (long long i = l; i%9!=0 && i<=r; i++)
    {
        ret+=i%9;
        awal=i;
    }
    if((awal+1)%9==0){
        ret+=9;
    }
    long long akhir=0;
    for (long long i = r; i%9!=0 && i>awal; i--)
    {
        ret+=i%9;
        akhir=i;
    }
    ret+=((akhir-awal)/9)*45;
    return ret;
}
int main(){
    int q;
    cin>>q;
    while ( q--)
    {
        long long l,r;
        cin>>l>>r;
        cout<<f(l,r);
    }
    
}

Compilation message

trol.cpp: In function 'long long int f(long long int, long long int)':
trol.cpp:11:13: warning: 'awal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   11 |     if((awal+1)%9==0){
      |        ~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 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 1 ms 344 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct