# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937088 | ASGA_RedSea | Trol (COCI19_trol) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* بسم الله الرحمن الرحيم *
﴾ رَبِّ اشْرَحْ لِي صَدْرِي * وَيَسِّرْ لِي أَمْرِي * وَاحْلُلْ عُقْدَةً مِّن لِّسَانِي * يَفْقَهُوا قَوْلِي ﴿
*/
/// author : "ASGA_RedSea"
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const ll mod = 1000000007;
signed main(){
ios_base::sync_with_stdio(0);
///cout.tie(0);
cin.tie(0);
///cout << fixed << setprecision(6);
///freopen("test.in", "r", stdin);
///freopen("test.out", "w", stdout);
int t;
cin >> t;
while(t--){
ll l,r;
cin >> l >> r;
ll ans = 0;
while(l <= r && (l % 9) != 1){
ans += (l % 9 == 0 ? 9 : l % 9);
l++;
}
while(r >= l && (r % 9) != 0){
ans += r % 9;
r--;
}
ans += ((r - l + 1) / 9) * 45;
cout << ans << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |