Submission #1053640

#TimeUsernameProblemLanguageResultExecution timeMemory
1053640vjudge1Trol (COCI19_trol)C++17
50 / 50
1 ms348 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...