Submission #976414

#TimeUsernameProblemLanguageResultExecution timeMemory
976414vjudge1Star triangles (IZhO11_triangle)C++17
0 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int q; cin >> q; while (q--) { ll l, r; cin >> l >> r; int ans = 0; ll selisih = (r-l)/9; int sisa = (r-l)%9; int hah = l%9; for (int i=hah;i<=8+hah;i++) { ans += i*selisih; } for (int i=hah;i<=(hah)+sisa;i++) { ans += i; } cout << ans << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...