zoukankan      html  css  js  c++  java
  • 1011 A+B 和 C

    给定区间 [-2^31,2^31]内的 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
    
     

    输出样例:

    Case #1: false
    Case #2: true
    Case #3: true
    Case #4: false



    #include<stdlib.h>
    #include<string.h>
    #include<math.h>
    
    int main(){
        int count;
        scanf("%d",&count);
    
        long a[10];
        long b[10];
        long c[10];
        for(int i=0;i<count;i++){
            scanf("%ld %ld %ld",&a[i],&b[i],&c[i]);
        }
    
        for(int j=0;j<count;j++){
            printf("Case #%d: %s
    ", j+1, a[j]+b[j]>c[j]?"true":"false");
        }
    
        return 0;
    }




  • 相关阅读:
    Chp18: Hard
    内存泄漏 和 内存溢出
    Chp4: Trees and Graphs
    trie树--详解
    Tries
    Comparable & Comparator
    memory leak
    8个月从CS菜鸟到拿到Google Offer的经历+内推
    Word Ladder II
    Java垃圾回收机制
  • 原文地址:https://www.cnblogs.com/shuicaojing/p/13879940.html
Copyright © 2011-2022 走看看