Submission #249372

#TimeUsernameProblemLanguageResultExecution timeMemory
249372tushar_2658Trol (COCI19_trol)C++14
50 / 50
1 ms256 KiB
#include "bits/stdc++.h" using namespace std; const int maxn = 105; using ll = long long; int get(ll x){ while(x > 9){ int sum = 0; while(x > 9){ sum += x % 10; x /= 10; } sum += x; x = sum; } return x; } ll f(ll x){ ll ret = 45 * (x / 9); x %= 9; ret += (x * (x + 1))/2; return ret; } int main(int argc, char const *argv[]) { int q; scanf("%d", &q); while(q--){ ll l, r; scanf("%lld %lld", &l, &r); printf("%lld\n", f(r) - f(l - 1)); } return 0; }

Compilation message (stderr)

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