# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975439 |
2024-05-05T07:38:40 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#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;
int l1 = ((l-1)/9)*45;
int sisa = (l-1)%9;
for(int i=1; i<=sisa; i++)
{
l1 += i;
}
int r1 = (r/9)*45;
sisa = r%9;
for(int i=1; i<=sisa; i++)
{
r1 += i;
}
cout << r1-l1 << endl;;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |