#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Foxfur ios_base::sync_with_stdio(0);cin.tie(NULL);
int32_t main()
{
Foxfur
int q; cin >> q;
while(q--)
{
int l,r; cin >> l >> r;
/*tmpl = ((l-1)*l)/2;
tmpr = (r*(r+1))/2;
int jml = r/9;*/
int ans = 0;
for(int i=l; i<=r; i++)
{
int x=i;
if(x%9==0){
ans +=9;
continue;
}
ans+=x%9;
}
//int ans = (tmpr-tmpl);
cout << ans << endl;;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
452 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
1079 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
1027 ms |
344 KB |
Time limit exceeded |