1011. A+B和C (15)
来源:互联网 发布:俄罗斯杜马选举知乎 编辑:程序博客网 时间:2024/06/18 16:22
import java.util.ArrayList;import java.util.Scanner;public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); ArrayList<Student> list = new ArrayList<>(); int[] flag = new int[n]; for(int i = 0 ; i < n ; ++i){ Student student = new Student(); student.setA(scanner.nextInt()); student.setB(scanner.nextInt()); student.setC(scanner.nextInt()); list.add(student); } for(int i = 0 ; i < n ; ++i){ if(list.get(i).getA() + list.get(i).getB() > list.get(i).getC()){ flag[i] = 1; }else{ flag[i] = 0; } } for(int i = 0 ; i < n ; ++i){ if(flag[i] == 1){ System.out.println("Case #" + (i+1) + ": true"); }else{ System.out.println("Case #" + (i+1) + ": false"); } } }}class Student { private long A; private long B; private long C; public long getA() { return A; } public void setA(long a) { A = a; } public long getB() { return B; } public void setB(long b) { B = b; } public long getC() { return C; } public void setC(long c) { C = c; }}
阅读全文
0 0
- 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)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1011. A+B和C (15)
- 1010. 一元多项式求导 (25)
- AIDL
- 剑指offer——把二叉树打印成多行(一般)
- mysql where 加引号和不加引号
- Android-数据存储方式2(SharedPreferences)
- 1011. A+B和C (15)
- 在ROS Kinetic和Gazebo 8中使用智能汽车仿真演示
- easyUI(1)-------合并单元格
- 1013. 数素数 (20)
- Spark性能优化指南——高级篇
- String 类------字符串转字符数组判断字符串中是否含有字母
- 前端学习(一)CSS基础
- JavaScript实现图片预览功能
- 程序员老司机总结的22个编程经验(转)