给定区间 [-2^31, 2^31] 内的 3 个整数 a、b 和 c,请判断 a+b 是否大于 c。
输入格式:
输入第 1 行给出正整数 t (≤10),是测试用例的个数。随后给出 t 组测试用例,每组占一行,顺序给出 a、b 和 c。整数间以空格分隔。
输出格式:
对每组测试用例,在一行中输出 case #x: true
如果 a+b>c,否则输出 case #x: false
,其中 x
是测试用例的编号(从 1 开始)。
输入样例:
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
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int n,t=1; 6 long long int a,b,c,sum; 7 scanf("%d",&n); 8 for(int i=0;i<n;i++) 9 { 10 scanf("%lld %lld %lld",&a,&b,&c); 11 sum=a+b; 12 if(sum>c) 13 printf("case #%d: truen",t); 14 else 15 printf("case #%d: falsen",t); 16 t++; 17 } 18 return 0; 19 }
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/c-cdevelopment/605702.html