1065 A+B and C (64bit) (20分)

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
const int maxn = 100011;

int main()
{
    freopen("1.txt","r",stdin);
    int n;
    //cin>>n;
    scanf("%d",&n);
    for(int i = 1;i<=n;i++)
    {
        long long a,b,c;
        //cin>>a>>b>>c;
        scanf("%lld%lld%lld",&a,&b,&c);
        long long sum = a+b;
        int mark;
        if(a>0&&b>0&&sum<0)
        {
            mark = 1; //正向溢出
        }
        else if(a<0&&b<0&&sum>=0)
        {
            mark = 0;  //负向溢出
        }
        else if(sum > c)
        {
            mark = 1;
        }
        else
        {
            mark = 0;
        }
        if(mark == 1)
        {
            cout<<"Case #"<<i<<": true"<<endl;
        }
        else
        {
            cout<<"Case #"<<i<<": false"<<endl;
        }
    }
    return 0;
}

你可能感兴趣的:(1065 A+B and C (64bit) (20分))