Skip to content

1065 A+B and C (64bit)

Statement

Metadata

  • 作者: HOU, Qiming
  • 单位: 浙江大学
  • 代码长度限制: 16 KB
  • 时间限制: 400 ms
  • 内存限制: 64 MB

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 (\le 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

Thanks to Jiwen Lin for amending the test data.

Solution

#include <ctype.h>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6;

const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;

int main() {
    int t;
    cin >> t;
    int count = 1;
    while (t--) {
        ld a, b, c;
        scanf("%Lf%Lf%Lf", &a, &b, &c);
        printf("Case #%d: ", count++);
        if (a + b > c)
            cout << "true\n";
        else
            cout << "false\n";
    }
}

Last update: May 4, 2022
Back to top