# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974698 |
2024-05-03T16:12:40 Z |
vjudge1 |
Trol (COCI19_trol) |
C++14 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int q;
int pref[30], arr[30];
int get_range(int a, int b){
int l = (a - 1) % 9 + 1;
int 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++)
{
int l,r;
cin >> l >> r;
cout << get_range(l,r) << "\n";
}
}
Compilation message
cc1plus: error: '::main' must return 'int'