# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974699 |
2024-05-03T16:13:34 Z |
vjudge1 |
Trol (COCI19_trol) |
C++14 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll q;
ll pref[30], arr[30];
ll get_range(ll a, ll b){
ll l = (a - 1) % 9 + 1;
ll r = (b - 1) % 9 + 1;
return pref[r] - pref[l-1] + 45 * ((b - a) / 9);
}
int main(){
cin >> q;
pref[0] = 0;
for (int i = 0; i < 30; i++){
arr[i] = (i - 1) % 9 + 1;
pref[i] = arr[i] + pref[i-1];
}
for (int i = 0; i < q; i++)
{
ll l,r;
cin >> l >> r;
cout << get_range(l,r) << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |