Resolution:
- a, b, c in the range of [-2 63 is 2 63 is ], but is long long [-2 63 is 2 63 is -1], when the range is greater than the sum will overflow and become negative.
- So we need to be positive and negative overflow judgment.
#include <stdio.h>
int main(){
int n,tc=1;
scanf("%d",&n);
while(n--!=0){
long long a,b,c;
scanf("%lld%lld%lld",&a,&b,&c);
long long mm=a+b;
bool flag=false;
if(a>0&&b>0&&mm<0){flag=true;
}else if(a<0&&b<0&&mm>=0){
flag = false;
}else if(mm>c) {flag =true;}
if(flag==true)
{printf("Case #%d: true\n",tc);
}
else printf("Case #%d: false\n",tc);
tc++;
}
}