# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
704751 |
2023-03-03T00:34:06 Z |
becaido |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
320 KB |
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
int q;
ll l, r;
ll sum(int a, int b) {
return (a + b) * (b - a + 1) / 2;
}
ll sum(ll x) {
ll t = x / 9;
x %= 9;
return sum(1, 9) * t + sum(1, x);
}
void solve() {
cin >> q;
while (q--) {
cin >> l >> r;
cout << sum(r) - sum(l - 1) << '\n';
}
}
int main() {
Waimai;
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
0 ms |
320 KB |
Output is correct |