<>试题 A: 星期计算 【填空题】

public class one { public static void main(String[] args) { BigInteger
bigInteger= BigInteger.valueOf(20).pow(22).mod(BigInteger.valueOf(7)); int ha =
(bigInteger.intValue()+6)%7; System.out.println(ha); } }

public static void main(String[] args) { System.out.println(Math.pow(20, 22)%7+
6); }
<>试题 B: 山 【填空题】

public class two { public static void main(String[] args) { int count = 0; for(
int i =2022;i<=2022222022;i++) { if(check(i) && isHuiWen(i)) { count++; } }
System.out.println(count); } private static boolean check(int num) { String s =
num+""; for(int i =0;i<s.length()/2;i++) { if(s.charAt(i)>s.charAt(i+1)) return
false; } return true; } private static boolean isHuiWen(int num) { String s =
num+""; for(int i =0,r=s.length()-1;i<r;i++,r--) { if(s.charAt(i) != s.charAt(r)
) return false; } return true; } }

public class two { public static void main(String[] args) { int count = 0; for(
int i =2022;i<=2022222022;i++) { if(check(i) && isHuiWen1(i)) { count++; } }
System.out.println(count); } private static boolean check(int num) { String s =
num+""; for(int i =0;i<s.length()/2;i++) { if(s.charAt(i)>s.charAt(i+1)) return
false; } return true; } private static boolean isHuiWen1(int num) { String snum
= num+""; StringBuilder stringBuilder = new StringBuilder(snum); return
stringBuilder.reverse().toString().equals(snum); } }
<>试题 C: 字符统计【代码题】

public class three { public static void main(String[] args) { Scanner scanner =
new Scanner(System.in); String str = scanner.nextLine(); int[] arr = new int[26]
; String str1 = ""; for(int i =0;i<str.length();i++) { arr[str.charAt(i)-'A']++;
} int max = Integer.MIN_VALUE; for(int i =0;i<26;i++) { max = Math.max(max, arr[
i]); } for(int i=0;i<26;i++) { if(arr[i] == max) { str1=str1+""+(char)(i+'A'); }
} System.out.println(str1); } }

GitHub

Gitee