当前位置:网站首页>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博客
边栏推荐
- 粒子滤波 particle filter —从贝叶斯滤波到粒子滤波——Part-I(贝叶斯滤波)
- XAML WPF项目groupBox控件
- BITS Pilani|SAC-AP:基于 Soft Actor Critic 的深度强化学习用于警报优先级
- 2022年SQL经典面试题总结(带解析)
- MySQL 45 Talk | 09 How to choose common index and unique index?
- MySQL Lock wait timeout exceeded; try restarting transaction 锁等待
- 后台管理系统的权限思路
- 频域分析实践介绍
- Clip-on multimeter use method, how to measure the voltage, current, resistance?
- 使用设备树时对应的驱动编程
猜你喜欢

B011 - 51-based multifunctional fingerprint smart lock

C#/VB.NET:从 PDF 文档中提取所有表格

Three solutions: npm WARN config global --global, --local are deprecated. Use --location=global instead.

Leetcode74. Search 2D Matrix

Leetcode73. Matrix Zeroing

千万级乘客排队系统重构&压测方案总结篇

B001 - Intelligent ecological fish tank based on STM32

QT basic functions, signals, slots

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

How many steps does it take to convert an ENS domain name into music?
随机推荐
MySQL关系型数据库事务的ACID特性与实现方法
OnePlus 10RT appears on Geekbench, product launch also seems to be approaching
Topology Parts Disassembly 3D Visualization Solution
后台管理系统的权限思路
公用函数----mfc
golang json returns null
C语言理论--笔试面试基础稳固
深入浅出Flask PIN
XAML WPF item groupBox control
亚马逊云科技Build On2022技能提升计划第二季——揭秘出海爆款新物种背后的黑科技
用VS2013编译带boost库程序时提示 fatal error C1001: 编译器中发生内部错误
2022年SQL大厂高频实战面试题(详细解析)
Zabbix6.0钉钉机器人告警
Clip-on multimeter use method, how to measure the voltage, current, resistance?
QT basic functions, signals, slots
三维空间中点的插值
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) Solution
Leetcode72. Edit Distance
Leetcode71. 简化路径
EpiSci | Deep Reinforcement Learning for SoCs: Myth and Reality