一开始用大数运算···就像某网友说的:已哭晕在厕所···
根据题中要求:
①考虑到溢出
A>0&&B>0 而A+B<=0 或 A<0&&B<0 而A+B>=0 这两种情况即为 溢出 容易判断 前者必定大于未溢出的C而后者必定小于未溢出的C
②未溢出的 直接用用long long 进行判断
#include<iostream>
#include<cstring>
#include<map>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int T;
long long A, B, C, Sum;
cin>>T;
for(int i=1; i<=T; i++)
{
bool ans;
cin>>A>>B>>C;
Sum=A+B;
if(A>0&&B>0&&Sum<=0)
ans=true;
else
if(A<0&&B<0&&Sum>=0)
ans=false;
else
{
ans=(Sum>C ? true:false);
}
cout<<"Case #"<<i<<": "<<(ans ? "true" : "false")<<endl;
}
return 0;
}