zoukankan      html  css  js  c++  java
  • 【PAT甲级】1065 A+B and C (64bit) (20 分)(大数溢出)

    题意:

    输入三个整数A,B,C(long long范围内),输出是否A+B>C。

    trick:

    测试点2包括溢出的数据,判断一下是否溢出即可。

    AAAAAccepted code:

     1 #define HAVE_STRUCT_TIMESPEC
     2 #include<bits/stdc++.h>
     3 using namespace std;
     4 int main(){
     5     ios::sync_with_stdio(false);
     6     cin.tie(NULL);
     7     cout.tie(NULL);
     8     int t;
     9     cin>>t;
    10     for(int i=1;i<=t;++i){
    11         if(i!=1)
    12             cout<<"
    ";
    13         long long a,b,c;
    14         cin>>a>>b>>c;
    15         long long x=a+b;
    16         if(a>0&&b>0&&x<0){
    17             cout<<"Case #"<<i<<": true";
    18             continue;
    19         }
    20         else if(a<0&&b<0&&x>=0){
    21             cout<<"Case #"<<i<<": false";
    22             continue;
    23         }
    24         long long d=a+b;
    25         if(d>c)
    26             cout<<"Case #"<<i<<": true";
    27         else
    28             cout<<"Case #"<<i<<": false";
    29     }
    30     return 0;
    31 }
    保持热爱 不懈努力 不试试看怎么知道会失败呢(划掉) 世上无难事 只要肯放弃(划掉)
  • 相关阅读:
    点聚-weboffice 6.0 (二)
    点聚-weboffice 6.0 (一)
    Hibernate连接池设置
    ajax工作原理(转)
    LigerUI java SSH小例子
    file标签样式修改
    好久不来了,回来园子看看
    resharper 8.2
    无聊的要死
    无聊
  • 原文地址:https://www.cnblogs.com/ldudxy/p/11762743.html
Copyright © 2011-2022 走看看