当前位置:网站首页>Pat class B 1011 C language
Pat class B 1011 C language
2022-06-23 05:54:00 【Octopus bro】
1011. A+B and C (15)
Given the interval [-231, 231] Internal 3 It's an integer A、B and C, Please judge A+B Is it greater than C.
Input format :
Enter the first 1 Line gives a positive integer T(<=10), Is the number of test cases . Subsequently given T Group test cases , One row for each group , The order is given A、B and C. Integers are separated by spaces .
Output format :
For each group of test cases , Output in one line “Case #X: true” If A+B>C, Otherwise output “Case #X: false”, among X Is the number of the test case ( from 1 Start ).
sample input :4 1 2 3 2 3 4 2147483647 0 2147483646 0 -2147483648 -2147483647sample output :
Case #1: false Case #2: true Case #3: true Case #4: false
Ideas : Just judge directly , Attention, because the process may exceed int Value range of , Therefore, using long int Declare variables
Code :
#include "stdio.h"
int main(){
int x;
long int a,b,c;
int i;
scanf("%d",&x);
for(i = 0; i < x; i++)
{
scanf("%ld",&a);
scanf("%ld",&b);
scanf("%ld",&c);
if(a + b > c)
{
printf("Case #%d: true\n",i + 1);
}else
{
printf("Case #%d: false\n",i + 1);
}
}
return 0;
} 边栏推荐
- Low cost 5W wireless charger scheme fs68001b simple charging chip
- TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 网桥与交换机
- Basic calculator for leetcode topic analysis
- AHA C language Chapter 7 you can do more with it (talks 27-28)
- jvm-05.垃圾回收
- jvm-03.jvm内存模型
- Basic calculator II for leetcode topic analysis
- MySQL面试真题(二十九)——案例-找到爱看的电影
- How to move the software downloaded from win11 app store to the desktop
- What is the reason for the black screen of the computer monitor when the computer is turned on? What should I do about the black screen of the computer monitor
猜你喜欢

Real MySQL interview questions (XXVI) -- didi 2020 written examination questions

编址和编址单位

True MySQL interview question (XXII) -- condition screening and grouping screening after table connection

Heimdall database proxy scale out 20 times

visdom画多条动态损失曲线

MySQL面试真题(二十四)——行列互换

jvm-03.jvm内存模型

数字藏品赋能实体产业释放了哪些利好?

Wechat applet: Star Trek spaceship ticket production and generation
![[graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming](/img/04/3121514fcd8fcf1c939cbca7f4c67a.jpg)
[graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming
随机推荐
Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators
ssm项目搭建
Excel sheet column number for leetcode topic resolution
Three most advanced certifications, two innovative technologies and two outstanding cases, Alibaba cloud appeared at the cloud native industry conference
PAT 乙等 1014 C语言
Opportunities and challenges of digital collections from the perspective of technology development team
Real MySQL interview questions (25) -- common group comparison scenarios
C primer plus learning notes - 2. Constant and formatted IO (input / output)
Wechat applet: Star Trek spaceship ticket production and generation
PAT 乙等 1010 C语言
vant weapp日历组件性能优化 Calendar 日历添加min-date最小日期页面加载缓慢
JS interview question - anti shake function
Real MySQL interview question (23) -- pinduoduo ball game analysis
Yingjixin launched 4 series of lithium batteries 100W mobile power supply voltage rise and fall scheme SOC chip ip5389
[graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming
Alibaba cloud ack one and ACK cloud native AI suite have been newly released to meet the needs of the end of the computing era
iNFTnews | 加密之家从宇宙寄来的明信片,你会收到哪一张?
[Stanford Jiwang cs144 project] lab2: tcpreceiver
PAT 乙等 1015 C语言
知识点滴 - 折叠锻打和大马士革钢