zoukankan      html  css  js  c++  java
  • PAT Basic 1011

    1011 A+B 和 C (15 分)

    给定区间 [231​​,231​​] 内的 3 个整数 A、B 和 C,请判断 A+B 是否大于 C。

    输入格式:

    输入第 1 行给出正整数 T (10),是测试用例的个数。随后给出 T 组测试用例,每组占一行,顺序给出 A、B和 C。整数间以空格分隔。

    输出格式:

    对每组测试用例,在一行中输出 Case #X: true 如果 A+B>C,否则输出 Case #X: false,其中 X 是测试用例的编号(从 1 开始)。

    输入样例:

    4
    1 2 3
    2 3 4
    2147483647 0 2147483646
    0 -2147483648 -2147483647


    注意longlong的使用即可
    #define _CRT_SECURE_NO_WARNINGS
    #include<iostream>
    #include <vector>
    #include<algorithm>
    #include<string>
    #include<math.h>
    #define max 1000
    #define debug 0
    using namespace std;

    int main() {
    #if debug
        freopen("in.txt", "r", stdin);
    #endif

        int n = 0;
        long long A, B, C;
        cin >> n;
        for (int i = 0; i < n; i++)
        {
            cin >> A >> B >> C;
            cout << "Case #" << i + 1 << ": ";
            if (A + B > C)
            {
                cout << "true" << endl;
            }
            else
            {
                cout << "false" << endl;
            }
        }

    #if debug
        freopen("CON", "r", stdin);
    #endif
        return 0;
    }
  • 相关阅读:
    RandomAccessFile类
    IO_ObjectOutputStream(对象的序列化)
    IO流_文件切割与合并(带配置信息)
    IO流_文件切割与合并
    IO流_SequenceInputStream(序列流)
    10-stack
    9-queue
    16-两种方法全排列
    8-全排列next_permutation
    15-Call to your teacher(有向图的连通判断)
  • 原文地址:https://www.cnblogs.com/lxzbky/p/10500445.html
Copyright © 2011-2022 走看看