题解 | #牛牛的计划#
牛牛的计划
http://www.nowcoder.com/practice/cf956ceef9f84f7393a0b7284fdbf95a
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//计划的时间
String str1y = scan.next();
String str1m = scan.next();
String str1d = scan.next();
//询问时间
String str2y = scan.next();
String str2m = scan.next();
String str2d = scan.next();
int y1 = Integer.parseInt(str1y);
int m1 = Integer.parseInt(str1m);
int d1 = Integer.parseInt(str1d);
int y2 = Integer.parseInt(str2y);
int m2 = Integer.parseInt(str2m);
int d2 = Integer.parseInt(str2d);
if(y1 < y2) {
System.out.println("yes");
} else if(y1 == y2 && m1 < m2) {
System.out.println("yes");
} else if(y1 == y2 && m1 == m2 && d1 <= d2) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
Java基础练习题 文章被收录于专栏
都是一些基础的语法题目,每天可以刷几道。