当前位置:网站首页>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;
} 边栏推荐
- Centos7 installation of postgresql8.2.15 and creation of stored procedures
- How does win11 enable mobile hotspot? How to enable mobile hotspot in win11
- Advanced Mathematics (Seventh Edition) Tongji University exercises 1-7 personal solutions
- MySQL面试真题(三十)——贝壳-房产订单分析
- PAT 乙等 1020.月饼
- visdom的使用
- ORB_ Slam2 operation
- Real MySQL interview questions (XXVI) -- didi 2020 written examination questions
- 数字藏品市场才刚刚开始
- Software design and Development Notes 2: serial port debugging tool based on QT design
猜你喜欢

visdom画多条动态损失曲线

数字藏品如何赋能经济实体?

MySQL面试真题(二十七)——RFM分析法对用户进行分类

A bit of knowledge - folding forging and Damascus steel

jvm-01.指令重排

制造业数字化转型存在问题及原因分析

jvm-03.jvm内存模型

Real MySQL interview questions (25) -- common group comparison scenarios

Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators

Three most advanced certifications, two innovative technologies and two outstanding cases, Alibaba cloud appeared at the cloud native industry conference
随机推荐
June 22, 2022: golang multiple choice question, what does the following golang code output? A:3; B:1; C:4; D: Compilation failed. package main import ( “fmt“ ) func mai
Alibaba cloud object storage oss+picgo+typera implements the construction map
MySQL面试真题(二十五)——常见的分组比较场景
Centos7 installation of postgresql8.2.15 and creation of stored procedures
MySQL面试真题(二十六)——滴滴2020年笔试题
PAT 乙等 1026 程序运行时间
Wechat applet: future wife query generator
Basic calculator II for leetcode topic analysis
PAT 乙等 1019 C语言
Arctime makes Chinese and English subtitle video
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 网桥与交换机
Dolphin scheduler dolphin scheduling upgrade code transformation -upgradedolphin scheduler
PAT 乙等 1016 C语言
PAT 乙等 1012 C语言
Data migration from dolphin scheduler 1.2.1 to dolphin scheduler 2.0.5 and data test records after migration
PAT 乙等 1009 C语言
What benefits have digital collections enabled the real industry to release?
Yingjixin ip5566 with type-C port 3A charging and discharging fast charging mobile power supply 5W wireless charging in one SOC
Wechat applet: Puzzle toolbox
MySQL面试真题(二十一)——金融-贷款逾期