# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706600 | 2023-03-07T06:29:53 Z | YugiHacker | Trol (COCI19_trol) | C++14 | 1 ms | 316 KB |
#include<bits/stdc++.h> #define el cout<<"\n" #define f0(i,n) for(int i=0;i<n;++i) #define f1(i,n) for(int i=1;i<=n;++i) #define maxn using namespace std; int t; long long l, r; long long calc(long long n) { long long x = n/9; long long ans = x * 45; n%=9; f1 (i, n) ans += i; return ans; } main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> t; while (t--) { cin >> l >> r; cout << calc(r) - calc(l-1); el; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 316 KB | Output is correct |