제출 #892078

#제출 시각아이디문제언어결과실행 시간메모리
892078kh0iTrol (COCI19_trol)C++17
50 / 50
1 ms348 KiB
/** * author: kh0i * created: 21.03.2022 11:35:07 **/ #include "bits/stdc++.h" using namespace std; #ifdef LOCAL #include "debug.h" #else #define debug(...) #endif using ll = long long; ll sol(ll x){ ll res = 0; ll k = x / 9; res += k * 45; x = x % 9; for(int i = 1; i <= x; ++i) res += i; return res; } void solve(){ ll l, r; cin >> l >> r; cout << sol(r) - sol(l - 1) << '\n'; } int32_t main() { cin.tie(nullptr)->sync_with_stdio(0); int test = 1; cin >> test; for(int i = 1; i <= test; ++i){ solve(); } cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n"; return 0; } // Write stuff down
#Verdict Execution timeMemoryGrader output
Fetching results...