当前位置:网站首页>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博客
边栏推荐
- 【Day_08 0426】两种排序方法
- 【Day_09 0427】 另类加法
- Stop using MySQL online DDL
- Three solutions: npm WARN config global --global, --local are deprecated. Use --location=global instead.
- 顺序表的简单描述及代码的简单实现
- B005 - STC8 based single chip microcomputer intelligent street light control system
- Use of message template placeholders
- 【Day_12 0507】二进制插入
- The function realization of the national standard GB28181 protocol EasyGBS platform compatible with the old version of the inflow port
- 如何让固定点的监控设备在EasyCVR平台GIS电子地图上显示地理位置?
猜你喜欢
随机推荐
SQL函数 TO_DATE(一)
【Error】Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘concat’)
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
EpiSci | Deep Reinforcement Learning for SoCs: Myth and Reality
How to build a CMDB driven by consumption scenarios?
123123123123
Summer vacation first week wrap-up blog
三维空间中点的插值
typora操作手册
【Day_10 0428】井字棋
WinRAR | 将多个安装程序生成一个安装程序
Solve the problem that MySQL cannot insert Chinese data
计算IoU(D2L)
Basic image processing in opencv
Use of message template placeholders
用VS2013编译带boost库程序时提示 fatal error C1001: 编译器中发生内部错误
tooltip control
XAML WPF item groupBox control
Go GORM transaction instance analysis
sql添加索引









