1011. A+B和C (15)
2017-10-17 14:31
211 查看
原题: https://www.patest.cn/contests/pat-b-practise/1011
题目本身非常简单, 但有个小坑. 就是需要使用
long int, 而且看样子PAT提供的
编译器(gcc4.7.2), 使用scanf获取
long int的值时, 需要使用
%ld
完整实现:
#include <stdio.h> int main () { int t; long int a; long int b; long int c; int i = 0; scanf("%d", &t); while (t != 0) { scanf("%ld", &a); scanf("%ld", &b); scanf("%ld", &c); i = i + 1; if (a + b > c) { printf("Case #%d: true\n", i); } else { printf("Case #%d: false\n", i); } t = t - 1; } return 0; } /* input: 4 1 2 3 2 3 4 2147483647 0 2147483646 0 -2147483648 -2147483647 output: Case #1: false Case #2: true Case #3: true Case #4: false */
相关文章推荐
- PAT-B-1011. A+B和C (15)
- 编程题目: PAT 1011. A+B和C (15)
- pat 1011. A+B和C (15)
- 1011. A+B和C (15)
- PAT (Basic Level) Practise (中文)1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- PAT 1011. A+B和C (15)
- 浙江大学PAT_乙级_1011. A+B和C (15)
- 1011. A+B和C (15)
- PAT乙级1011. A+B和C (15)
- PAT 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)(数学啊 ZJU_PAT)
- 1011.A+B和C(15)
- 1011. A+B和C (15)
- PAT乙级训练题--1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)