解题思路:
注意事项:
参考代码:
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语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1049 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:598 |
兰顿蚂蚁 (C++代码)浏览:1049 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:543 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:916 |
The 3n + 1 problem (C语言代码)浏览:554 |
淘淘的名单 (C语言代码)浏览:1229 |
陶陶摘苹果2 (C语言代码)浏览:601 |
生日日数 (C语言代码)浏览:1502 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:776 |