Submission #823843

#TimeUsernameProblemLanguageResultExecution timeMemory
823843Sandarach151Trol (COCI19_trol)C++17
50 / 50
1 ms316 KiB
#include<bits/stdc++.h> using namespace std; long long func(long long x){ if(x%9==0){ return 9; } else{ return x%9; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while(t--){ long long a, b; cin >> a >> b; long long ans = 0; while(a%9!=1 && a<=b){ ans+=func(a); a++; } while(b%9!=0 && b>=a){ ans+=func(b); b--; } ans+=5*(b-a+1); cout << ans << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...