1. 程式人生 > >A1065 A+B and C (64bit)

A1065 A+B and C (64bit)

注意賦值以後才能判斷是否溢位

#include <stdio.h>
typedef long long LL;

int main()
{
	LL A,B,C;
	LL sum;
	int T;
	scanf("%d",&T);
	for(int i=1;i<=T;i++){			
		scanf("%lld%lld%lld",&A,&B,&C);
		sum = A+B;
		printf("Case #%d: ",i);
		if(A>0&&B>0&&sum<=0)printf("true\n"
); else if(A<0&&B<0&&sum>=0)printf("false\n"); else{ if(sum>C)printf("true\n"); else printf("false\n"); } } return 0; }