1065 A+B and C (64bit)

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> 

int main(){
    int n,i;
    long long int a,b,c; 

    scanf("%d",&n);
    for(i=1;i<=n;++i){
        bool flg = true;
        scanf("%lld %lld %lld",&a,&b,&c);
        long long res = a+b;
        if(a>0 && b>0 && res<=0)flg = true;
        else if(a<0 && b<0 && res>=0)flg = false;
        else{
            if(res<=c)flg = false;
        }
        if(flg){
            printf("Case #%d: true\n",i);
        }else{
            printf("Case #%d: false\n",i);
        }
    }
    return 0;
}

PAT甲级——1065 A+B and C (64bit)的更多相关文章

  1. pat 甲级 1065. A+B and C (64bit) (20)

    1065. A+B and C (64bit) (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming G ...

  2. PAT 甲级 1065 A+B and C (64bit) (20 分)(溢出判断)*

    1065 A+B and C (64bit) (20 分)   Given three integers A, B and C in [−], you are supposed to tell whe ...

  3. PAT 甲级 1065. A+B and C (64bit) (20) 【大数加法】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1065 思路 因为 a 和 b 都是 在 long long 范围内的 但是 a + b 可能会 ...

  4. PAT——甲级1065:A+B and C(64bit) 乙级1010一元多项式求导

    甲级1065 1065 A+B and C (64bit) (20 point(s)) Given three integers A, B and C in [−2​63​​,2​63​​], you ...

  5. PAT A 1065. A+B and C (64bit) (20)

    题目 Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Inpu ...

  6. pat(A) 1065. A+B and C (64bit) (java大数)

    代码: import java.util.*; import java.math.*; public class Main { public static void main(String args[ ...

  7. PAT Advanced 1065 A+B and C (64bit) (20 分)(关于g++和clang++修改后能使用)

    Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specificati ...

  8. PAT甲级——A1065 A+B and C (64bit)

    Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specificati ...

  9. PAT 1065 A+B and C (64bit) (20)

    1065. A+B and C (64bit) (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming G ...

随机推荐

  1. Linux学习-第二章(命令)20200216

  2. HTML与CSS结合的四种方式

    HTML与CSS结合的四种方式: 方式一:每个标签加一个属性: 例如:<div style="background-color:red; color: green"> ...

  3. 应用架构的演进--MVC,RPC,SOA,微服务架构

    MVC架构:垂直应用架构 当访问量逐渐增大,单一应用增加机器带来的加速度越来越小,将应用拆成互不相干的几个应用,以提升效率. 当业务规模很小时,将所有功能都部署在同一个进程中,通过双机或者前置负载均衡 ...

  4. @Autowired注解与@Resource注解的区别(详细)

    相信对现在Java码农来说,@Autowired跟@Resource并不陌生,二者都可以自动注入,但是两者的区别很多时候并没有被注意到. 一.注解的出处 @Autowired是Spring提供的注解, ...

  5. mysql5.7.21源码安装

    1.下载安装包 MySQL 官方下载地址:https://dev.mysql.com/downloads/mysql/  MySQL 5.7官方安装文档:https://dev.mysql.com/d ...

  6. winform显示、隐藏任务栏及开始菜单

    private const int SW_HIDE = 0; //隐藏 private const int SW_RESTORE = 9;//显示 /// <summary> /// 获取 ...

  7. POJ 3321 Apple Tree 树状数组 第一题

    第一次做树状数组,这个东西还是蛮神奇的,通过一个简单的C数组就可以表示出整个序列的值,并且可以用logN的复杂度进行改值与求和. 这道题目我根本不知道怎么和树状数组扯上的关系,刚开始我想直接按图来遍历 ...

  8. 吴裕雄--天生自然 JAVASCRIPT开发学习:函数定义

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. postman批量接口测试注意事项

    1.使用cvs文件 导入文件后最后行出现\r符号 用文本打开 删除最后一行空白行 2.打印cvs文件中的接口调用的参数 Pre-request Script: var beginDate=data.b ...

  10. DOCKER 学习笔记6 WINDOWS版尝鲜

    前言 经过前两节的学习,我们已经可以在Dokcer 环境下部署基本的主流环境有: Springboot 后端 MYSQL 持久化数据 以及Nginx 作为反向代理 虽说服务器上面的也没啥不好,但是毕竟 ...