题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1065

思路分析:

1)对a+b造成的long long 类型的数据溢出进行特殊处理:

a>0 && b>0 && a+b<=0 :则a+b必大于c

a<0 && b<0 && a+b>=0 :则a+b必小于c

 #include <stdio.h>
#include <stdlib.h> int main(int argc,char *argv[]){
long long a,b,res; int n;
scanf("%d",&n);
bool flag;
for(int i=;i<=n;i++){
scanf("%lld %lld %lld",&a,&b,&res);
long long tmp=a+b; if(a> && b> && tmp<=)flag=true;
else if(a< && b< && tmp>=) flag=false;
else flag=a+b>tmp; printf("Case #%d:",i);
if(flag) puts("true");
else puts("false");
} system("pause");
return ;
}

PAT 65. A+B and C (64bit) (20)的更多相关文章

  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 A1065 A+B and C (64bit) (20 分)

    AC代码 #include <cstdio> int main() { #ifdef ONLINE_JUDGE #else freopen("1.txt", " ...

  3. 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 ...

  4. 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 ...

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

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

  6. A1065 A+B and C (64bit) (20)(20 分)

    A1065 A+B and C (64bit) (20)(20 分) Given three integers A, B and C in [-2^63^, 2^63^], you are suppo ...

  7. PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...

  8. PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...

  9. PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...

随机推荐

  1. ecmascript 的一些发展新动向

    ========== ecmascript 的一些发展新动向 (e5a57b27 - initial commit) 更弱.更受限 严格模式禁止 arguments.callee - 可以 " ...

  2. JS通用表单验证函数,基于javascript正则表达式

    表单的验证在实际的开发当中是件很烦琐又无趣的事情今天在做一个小项目的时候,需要JS验证,寻找到一个比较好的东西 地址如下: http://blog.csdn.net/goodfunman/archiv ...

  3. 在类库中使用log4net

    最近在做一个类库,用的C#写的,为了DEBUG方便需要日志输出,于是找了log4net这个工具进行日志输出; 因为调用这个类库的是C++,而且本人对C++不是很熟悉,于是无法在app.config或者 ...

  4. substr vs substring

    javascript(js)中的 substring和substr方法 Posted on 2009-02-26 14:14 chinaifne 阅读(33698) 评论(0) 编辑 收藏 1.sub ...

  5. 深入理解7816(1)---- 关于F/D和etu

    对于刚接触智能卡的工程师来说,在阅读7816-3规范的时候,常常被其中的一些术语迷惑,读起来会觉得有些别扭.尤其是在看到复位应答中的F和D设置,以及对应的etu的时候,会觉得有些复杂和难以理解. 其实 ...

  6. leetcode_question_112 Path Sum

    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...

  7. B树叶子节点split

    一.B-Tree索引的分裂 1. 创建测试表 SQL> create table split_tab (id number, name varchar2(100)); 表已创建. SQL> ...

  8. to_char函数引发的不走索引

    SQL> conn cowork_czsh/cowork_czsh Connected. SQL> set linesize 200 SQL> set pagesize 200 SQ ...

  9. 【转】win7+ubuntu双系统安装方法--不错

    原文网址:http://blog.csdn.net/lvanneo/article/details/16885121 前段时间又安装一下win7+ubuntu双系统,过段时间就会忘记,这次自己写下来, ...

  10. Android 使用HorizontalScrollView 实现Gallery效果

    Gallery(画廊)是一个锁定中心条目并且拥有水平滚动列表的视图,一般用来浏览图片,并且可以响应事件显示信息:Gallery还可以和ImageSwitcher组件结合使用来实现一个通过缩略图来浏览图 ...