I have two vectors "a" and "b" of long long ints, and I wish put the difference of respective elements of "a" and "b" into a vector "c". But I don't want these differences to go below 0.
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<long long int> a={360757931684,484141693549};
vector<long long int> b={186119101678,675563431537};
vector<long long int> c;
vector<long long int> d;
for (int i=0; i<2; i++){
// c.push_back(max(0,a[i]-b[i]));
c.push_back(max(0ll,a[i]-b[i]));
//I need to use "0ll" to make this work, Because the commented line above doesn't work
}
for (int i=0; i<2; i++){
if (a[i]-b[i]>0)
//Here this works fine even without "0ll"
d.push_back(a[i]-b[i]);
else
d.push_back(0);
}
return 0;
}
While using std::max function I had to use 0ll, but while using > operator using only 0 was sufficient. Why?