解题思路:
注意事项:
参考代码:
import java.lang.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //1.找出这个月第一天是星期几 //输入三个数,年,月,月 int a = sc.nextInt(); String[] h = new String[a]; for (int i = 0; i < a; i++) { int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); if (tm(b,c,d)) {//true; h[i] = "YES"; } else {//false h[i] = "NO"; } } for (int i = 0; i < a; i++) { System.out.println(h[i]); } } public static boolean tm(int b,int c, int d) { int[] k = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int j = b % 4; int x = 0,y = 0; int g = b % 400; if(j == 0 || g == 0){ k[1] = 29; }else{ k[1] = 28; } for (int i = 0; i < 12; i++) { } for(int i = 0; i < c-1; i++){ x = x + k[i]; } int sum = x % 7 + 1; for(int i = 0; i < d-1; i++){ y = y + k[i]; } int sum1 = y % 7 + 1; if(sum == sum1){ return true; }else{ return false; } } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:1005 |
弟弟的作业 (C++代码)浏览:957 |
C语言程序设计教程(第三版)课后习题5.8 (C++代码)浏览:693 |
C语言训练-邮票组合问题* (C语言代码)浏览:713 |
C语言训练-斐波纳契数列 (C语言代码)浏览:826 |
点我有惊喜!你懂得!浏览:2114 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:1019 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:556 |
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:619 |
求圆的面积 (C语言代码)浏览:1366 |