# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160334 | 2019-10-27T02:55:55 Z | model_code | Trol (COCI19_trol) | C++17 | 1000 ms | 376 KB |
#include <cstdio> using namespace std; typedef long long llint; int q; int value(llint x) { if (x < 10) return (int) x; llint sum = 0; while (x) { sum += (llint) (x % 10); x /= 10; } return value(sum); } int main(void) { scanf("%d", &q); while (q--) { llint l, r; scanf("%lld%lld", &l, &r); int sol = 0; for (llint i = l; i <= r; ++i) { sol += value(i); } printf("%d\n", sol); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 376 KB | Output is correct |
4 | Execution timed out | 1077 ms | 376 KB | Time limit exceeded |
5 | Execution timed out | 1078 ms | 376 KB | Time limit exceeded |