当前位置:网站首页>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博客
边栏推荐
- XAML WPF项目groupBox控件
- Basic image processing in opencv
- 一加OnePlus 10RT出现在Geekbench上 产品发布似乎也已临近
- md5sum源码 可多平台编译
- LeetCode 1374.生成每种字符都是奇数个的字符串
- Live chat system technology (8) : vivo live IM message module architecture practice in the system
- 2022年SQL大厂高频实战面试题(详细解析)
- Leetcode73. 矩阵置零
- SQL的substring_index()用法——MySQL字符串截取
- 以消费场景为驱动的CMDB要怎么建?
猜你喜欢
随机推荐
MySQL关系型数据库事务的ACID特性与实现方法
SQL函数 TO_DATE(二)
QT基础功能,信号、槽
Leetcode73. 矩阵置零
SQL的索引详细介绍
2022年MySQL最新面试题
8月微软技术课程,欢迎参与
golang json returns null
理财产品的月年化收益率怎么算?
Leetcode72. Edit Distance
opencv如何实现图像倾斜校正
Leetcode74. Search 2D Matrix
tooltip control
C语言理论--笔试面试基础稳固
Use of message template placeholders
OpenCV安装、QT、VS配置项目设置
消息模板占位符的使用
LeetCode 0151.颠倒字符串中的单词
突破性能天花板!亚信数据库支撑 10 多亿用户,峰值每秒百万交易
极化微波成像概述









