PAT A1065 A+B and C (64bit) (20 分)
AC代码
#include <cstdio>
int main() {
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE
char str[2][10] = {"false", "true"};
int n, tcase = 1;
scanf("%d", &n);
for(int i = 0; i < n; i++) {
int flag = 0;
long long a, b, c;
scanf("%lld%lld%lld", &a, &b, &c);
long long d = a + b;
//printf("%lld %lld %lld %lld\n", a, b, c, d);
/*if(c - b >= a) {
flag = 0;
printf("flag:%d\n", flag);
} else {
flag = 1;
printf("flag:%d\n", flag);
}*/
if(a > 0 && b > 0 && d < 0) flag = 1;
else if(a < 0 && b < 0 && d >= 0) flag = 0;
else if(d > c) flag = 1;
else flag = 0;
printf("Case #%d: %s\n", tcase++, str[flag]);
}
return 0;
}
吾生也有涯,而知也无涯。