A1065 A+B and C (64bit)

news/2024/10/23 9:29:34/

1065 A+B and C (64bit) (20 分)

Given three integers A, B and C in [−2^{63}​​,2^{63}], you are supposed to tell whether A+B>C.

Input Specification:

The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.

Output Specification:

For each test case, output in one line Case #X: true if A+B>C, or Case #X: false otherwise, where X is the case number (starting from 1).

Sample Input:

3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0

Sample Output:

Case #1: false
Case #2: true
Case #3: false
#include <cstdio>
using namespace std;int main()
{int t, num = 0;long long a, b, c;scanf("%d", &t) ;while(t--){scanf("%lld%lld%lld", &a, &b, &c);long long sum = a + b;bool flag;if(a>0 && b>0 && sum<0) flag = true;else if(a<0 && b<0 && sum>=0) flag = false;else if(sum > c) flag = true;else flag = false;if(flag == true){printf("Case #%d: true\n", ++num);}else {printf("Case #%d: false\n", ++num);}}return 0;
}

 


http://www.ppmy.cn/news/323924.html

相关文章

PAT a1128

目的:判断是不是Queens Puzzle 输入&#xff1a; K 例子个数&#xff0c;[1 200] N 图片大小&#xff0c;[4 1000] 输出&#xff1a; 是的输出&#xff0c;YES 不是输出&#xff0c;NO 算法&#xff1a; 不在一行好判断&#xff0c;不在一条斜线上&#xff0c;在一条…

1286

找新朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5697 Accepted Submission(s): 2940 Problem Description 新年快到了&#xff0c;“猪头帮协会”准备搞一个聚会&#xff0c;已经知道现有会员N人&a…

洛谷 P1866 编号

题目描述 太郎有N只兔子&#xff0c;现在为了方便识别它们&#xff0c;太郎要给他们编号。兔子们向太郎表达了它们对号码的喜好&#xff0c;每个兔子i想要一个整数&#xff0c;介于1和Maxnumber[i]之间&#xff08;包括1和Maxnumber[i]&#xff09;。当然&#xff0c;每个兔子…

全程15分钟 详解如何为MacBook Pro 15寸 加装固态硬

本文导航 第1页&#xff1a;详解如何为MBP15加装固态硬第2页&#xff1a;用时约3分钟&#xff1a;查看硬盘和光驱接口信息第3页&#xff1a;用时约2分钟&#xff1a;拆解机身底盖螺丝 第4页&#xff1a;用时约3分钟&#xff1a;拆解光驱和清理风扇第5页&#xff1a;用时约5分…

A1062(25)

德才论 看题目可能会觉得简单&#xff0c;但是实际的话会有些麻烦。注意根据题意将输出分为四个类别&#xff0c;即德才均达标&#xff0c;德达标&#xff0c;德大于才&#xff0c;其余。先按照类比来比较&#xff0c;类别相同&#xff0c;比较总分&#xff0c;总分相同比较德分…

A1042

Shuffling Machine (20分) 单词&#xff1a; shuffling&#xff1a;洗牌 position&#xff1a;位置the number at the i-th position is j, it means to move the card from position i to position j&#xff1a;第i个位置上是j&#xff0c;表示移动第i个位置上的数…

mac屏蔽独显(我的小本本自救系列)

原文网址&#xff1a; http://www.asyncro.com/2014/03/2 ... -issue-fix-updated/本人只负责搬运以及翻译。整个步骤有效性自己验证。下述论坛用户反映&#xff0c;按照这个方法的确有效&#xff0c;http://apple.stackexchange.com/q ... -graphics-macbook-p 简单翻译下&…

【Docker】docker部署前Springboot-vue后端分离项目【实战篇】

文章目录 1、docker 安装jdk2、docker 安装mysql通过Docker命令进入Mysql容器内部初始化数据sqlDbx连接查看 3、docker build构建后端镜像修改配置数据库JDBC链接IP为虚拟机服务器IPmaven clean package打包后端jar并上传到服务器编写Dockfilebuild 构建查看构建的后端镜像app …