# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1053640 |
2024-08-11T14:52:28 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl "\n"
#define ll long long
#define str string
#define dl double
#define ts(val) to_string(val)
#define ti(val) stoi(val)
#define ft first
#define sc second
#define Pb push_back
#define pB pop_back
#define mp make_pair
#define mst(array,value) memset(array,value,sizeof(array))
#define gtr greater<int>()
#define all(ar) ar.begin(),ar.end()
using namespace std;
#define ull unsigned long long int
//#define int long long
ull sum[] = {9,1,2,3,4,5,6,7,8};
signed main() {
//fast
//cout << (ll)pow(2,60);
//1152921504606846976
int t; cin >> t;
while(t--) {
ull a,b; cin >> a >> b;
ull x = a%9, y = b%9;
//cout << x << " " << y << nl;
ull z = (b-a)/9;
//cout << z << nl;
ull ans = z*45;
//cout << ans << nl;
if(x > y) {
for(int i=x;i<=8;i++) ans += sum[i];
for(int i=0;i<=y;i++) ans += sum[i];
} else {
for(int i=x;i<=y;i++) ans += sum[i];
}
cout << ans << nl;
}
return 0;
}
Compilation message
trol.cpp: In function 'int main()':
trol.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
41 | for(int i=0;i<=y;i++) ans += sum[i];
| ~^~~
trol.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
43 | for(int i=x;i<=y;i++) ans += sum[i];
| ~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |