<p style="margin-top: 0px; margin-bottom: 1.5em; padding-top: 0px; padding-bottom: 0px; border: 0px; font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; vertical-align: baseline; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">给定区间[-2<sup style="line-height: 0;">31</sup>, 2<sup style="line-height: 0;">31</sup>]内的3个整数A、B和C,请判断A+B是否大于C。</p><p style="margin-top: 0px; margin-bottom: 1.5em; padding-top: 0px; padding-bottom: 0px; border: 0px; font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; vertical-align: baseline; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);"><strong>输入格式:</strong></p><p style="margin-top: 0px; margin-bottom: 1.5em; padding-top: 0px; padding-bottom: 0px; border: 0px; font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; vertical-align: baseline; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">输入第1行给出正整数T(<=10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。</p><p style="margin-top: 0px; margin-bottom: 1.5em; padding-top: 0px; padding-bottom: 0px; border: 0px; font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; vertical-align: baseline; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);"><strong>输出格式:</strong></p><p style="margin-top: 0px; margin-bottom: 1.5em; padding-top: 0px; padding-bottom: 0px; border: 0px; font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; vertical-align: baseline; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">对每组测试用例,在一行中输出“Case #X: true”如果A+B>C,否则输出“Case #X: false”,其中X是测试用例的编号(从1开始)。</p><span style="color: rgb(51, 51, 51); font-family: 'Droid Sans', Verdana, 'Microsoft YaHei', Tahoma, sans-serif; line-height: 18px; background-color: rgb(250, 250, 250);">输入样例:</span><pre style="margin-top: 1.5em; margin-bottom: 1.5em; padding: 0px; border: 0px; font-family: 'Droid Sans Mono', Consolas, 'Courier New', monospace; line-height: 18px; vertical-align: baseline; overflow: auto; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647
输出样例:
Case #1: false
Case #2: true
Case #3: true
Case #4: false
#include <stdio.h>
int main(void)
{
int N;
int i;
double a, b, c;
scanf("%d", &N);
for(i = 0; i < N; i++)
{
scanf("%lf %lf %lf", &a, &b, &c);
if(a + b > c)
printf("Case #%d: true\n", i+1);
else
printf("Case #%d: false\n", i+1);
}
return 0;
}
/*
7'14" AC
真心是水题,因为题目要求:
给定区间[-231, 231]内的3个整数
所以,不需要用高精度加法的算法
*/