제출 #1257856

#제출 시각아이디문제언어결과실행 시간메모리
1257856arnaaTrol (COCI19_trol)C++20
40 / 50
1 ms328 KiB
#include<bits/stdc++.h> using namespace std; int digit(long long x){ if(x<=0) return 0; long long jum = x / 9; long long ans = x % 9; return jum * 45 + ( ans * ( ans + 1 )) /2; } int main(){ int q; long long l,r; cin>>q; for(int i=1;i<=q;i++){ cin>>l>>r; long long ans= digit(r) - digit(l-1); cout<<ans<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...