当前位置:网站首页>1065 A+B and C (64bit)
1065 A+B and C (64bit)
2022-08-01 18:15:00 【Brosto_Cloud】
Given three integers A, B and C in (−263,263), 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). Each line should ends with '\n'.
Sample Input:
3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0
Sample Output:
Case #1: false
Case #2: true
Case #3: false#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stdlib.h>
using namespace std;
long long int a, b, c, t, n, sum;
int main() {
cin >> t;
while (t--) {
scanf("%lld %lld %lld",&a, &b, &c);
n++;
sum = a + b;
cout << "Case #" << n << ": ";
if (a > 0 && b > 0 && sum < 0) {
cout << "true" << endl;
} else if (a < 0 && b < 0 && sum >= 0) {
cout << "false" << endl;
} else {
if (sum > c) {
cout << "true" << endl;
} else {
cout << "false" << endl;
}
}
}
return 0;
}参考博客:1065 A+B and C (64bit) (20分)_mob60475705f1df的技术博客_51CTO博客
边栏推荐
猜你喜欢

QT常用全局宏定义

QT_QThread thread

分布式消息队列平滑迁移技术实战

B001 - Intelligent ecological fish tank based on STM32

【Day_12 0507】查找组成一个偶数最接近的两个素数

Leetcode75. 颜色分类
Stop using MySQL online DDL

【Error】Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘concat’)

Leetcode71. 简化路径

粒子滤波 particle filter —从贝叶斯滤波到粒子滤波——Part-I(贝叶斯滤波)
随机推荐
【Day_10 0428】井字棋
Leetcode72. 编辑距离
LeetCode 0152. 乘积最大子数组:dp + 原地滚动
golang json 返回空值
存储日报-数据湖架构权威指南(使用 Iceberg 和 MinIO)
极化微波成像概述3
QLineEdit学习与使用
ACID Characteristics and Implementation Methods of MySQL Relational Database Transactions
极化微波成像概述
OpenCV installation, QT, VS configuration project settings
8月微软技术课程,欢迎参与
国标GB28181协议EasyGBS平台兼容老版本收流端口的功能实现
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
SQL function TO_DATE (1)
B005 - STC8 based single chip microcomputer intelligent street light control system
el-form-item prop属性动态绑定不生效如何解决
XAML WPF item groupBox control
一加OnePlus 10RT出现在Geekbench上 产品发布似乎也已临近
Leetcode73. Matrix Zeroing
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) 题解