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

来源:互联网 发布:cad自学软件 编辑:程序博客网 时间:2024/06/03 15:45

    考虑溢出

#include <iostream>#include <cstdio>#include <limits>using namespace std;int main(){int t;cin >> t;for(int i = 0; i < t; ++i){long long a, b, c;cin >> a >> b >> c;bool x = a >= 0, y = b >= 0, z = c >= 0;bool is = false;if(!x && !y && !z) is = a > c-b;else if(!x && !y && z) is = false;else if(!x && y && !z) is = a+b > c;else if(!x && y && z) is = a+b > c;else if(x && !y && !z) is = a+b > c;else if(x && !y && z) is = a+b > c;else if(x && y && z) is = true;else if(x && y && z) is = a > c-b;printf("Case #%d: %s\n", i+1, is ? "true" : "false");}return 0;}


0 0
原创粉丝点击