Submission #1253451

#TimeUsernameProblemLanguageResultExecution timeMemory
1253451terracottaliteTrol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#include <stdio.h>

long long f(long long a) {
    return (a/9)*45 + ((a%9)*(a%9+1))/2;
}

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

    while (q--) {
        long long l, r;
        scanf("%lld %lld", &l, &r);
        
        printf("%lld\n", f(r) - f(l-1));
    }
}

Compilation message (stderr)

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