# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
198073 | 2020-01-24T15:39:17 Z | ZwariowanyMarcin | Trol (COCI19_trol) | C++14 | 12 ms | 396 KB |
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define ss(x) (int) x.size() #define pb push_back #define LL long long #define ld double #define cat(x) cerr << #x << " = " << x << endl #define FOR(i, j, n) for(int i = j; i <= n; ++i) #define boost cin.tie(0), ios_base::sync_with_stdio(0); using namespace std; int T; LL a, b; int main() { scanf ("%d", &T); while (T--) { LL c = 0; scanf ("%lld%lld", &a, &b); for (int i = 0; i < 9; ++i) { LL l = a; while (l % 9 != i) l++; LL r = b; while (0 <= r && r % 9 != i) r--; int x = (i == 0 ? 9 : i); if (l <= r) c += 1LL * x * ((r - l) / 9 + 1); } printf ("%lld\n", c); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 12 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 396 KB | Output is correct |
5 | Correct | 1 ms | 376 KB | Output is correct |