新进API
.valueOf() | 返回给定参数的原生 Number 对象值 |
---|---|
.split("\\s+") | 将输入流中的各个元素由多个空格分隔开 |
int
定义x,y,z部分正确(9分))import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(bf.readLine());
int count = 1;
for (int i = 0; i < a; i++) {
String[] bufStrings = bf.readLine().split("\\s+");
long x = Long.valueOf(bufStrings[0]);
long y = Long.valueOf(bufStrings[1]);
long z = Long.valueOf(bufStrings[2]);
if ((x + y) > z) {
System.out.printf("Case #%d: true", count);
System.out.println();
} else {
System.out.printf("Case #%d: false", count);
System.out.println();
}
count++;
}
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class B_1011 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(bf.readLine());
StringBuilder sb = new StringBuilder("");
for (int i = 1; i < a + 1; i++) {
String[] str = bf.readLine().split(" ");
if ((Long.parseLong(str[0]) + Long.parseLong(str[1])) > Long.parseLong(str[2]))
sb.append("Case #" + i + ": true\n");
else
sb.append("Case #" + i + ": false\n");
}
System.out.println(sb.toString().trim());
}
}