# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
837277 | 2023-08-25T09:03:44 Z | LinkedArray | Trol (COCI19_trol) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long q, l, r, d, repeating, cif, sum; cin >> q; while(q--){ cin >> l >> r; sum = 0; repeating = (r - l + 1) / 9; cif = (l - 1 + 9) % 9 + 1; // Cifra de control al numarului L if(cif != 1){ // Cat timp nu este egala cu 1 sum += 45 - ((cif - 1) * cif / 2); // Adun la suma pana la 1 } sum += 45 * repeating; // Cifrele de control se repeta: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ..... cif = (r - 1 + 9) % 9 + 1; // Cifra de control al numarului R if(cif != 9){ // Cat timp nu este egala cu 9 sum += cif * (cif + 1) / 2; // Adunam la suma } cout << sum << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Incorrect | 1 ms | 212 KB | Output isn't correct |