April Fools Day Contest 2020
目录
- A
- 分析:
- AC代码:
- B
- 分析:
- AC代码:
- C
- 分析:
- AC代码:
- D
- 分析:
- AC代码:
- E
- 分析:
- AC代码:
- F
- 分析:
- AC代码:
A
分析:
这场比赛计分吗?
不计
AC代码:
public class A {
public static void main(String[] args) {
System.out.println("no");
}
}
B
分析:
一个藏头诗
two factors
AC代码:
import java.util.*;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=2;i<t;i++){
if(t%i==0){
System.out.println(i+""+t/i);return;
}
}
}
}
C
分析:
题目六个单词,有语病,二的六次方恰好等于64
所以跟二进制有关
题目为:
And they lived happily ever after.
AC代码:
import java.util.*;
public class C {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[6];
for(int i=5;i>=0;i--){
a[i]=n%2;
n/=2;
};
System.out.println(Integer.valueOf(a[0]+""+a[5]+""+a[3]+""+a[2]+""+a[4]+""+a[1],2));
}
}
D
分析:
判断奇数偶数,只判断最后一个字母就可以
偶数:0
奇数:1
AC代码:
import java.util.*;
public class D {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.next();
System.out.println((s.charAt(s.length()-1)-'0')%2);
}
}
E
分析:
这是一个曲里拐弯的圈,给一个坐标,判断是在里面还是外面
江山代有才人出,各领风骚数百年,哈哈
AC代码:
import java.util.Scanner;
public class E {
public static void main(String[] args) {
String s = "0000000000000000000000000010101111110100000000000000000000000000"
+ "0000000000000000000000101110101010010111110000000000000000000000"
+ "0000000000000000000011101000100011010000100100000000000000000000"
+ "0000000000000000011110101011111000011110101110100000000000000000"
+ "0000000000000000110000001010000011110000101010110000000000000000"
+ "0000000000000010011011111011101110100101100010010100000000000000"
+ "0000000000000111001001000000101000111100110110110110000000000000"
+ "0000000000011111101101101110111011100001100100100011100000000000"
+ "0000000000111111111111000010000010001011001101101001110000000000"
+ "0000000001111111111111111111101111111001111001111111111000000000"
+ "0000000011111111111111111111111111111111111111111111111100000000"
+ "0000000111111111111111111111111111111111111111111111111110000000"
+ "0000000111111111111111111111111111111111111111111111111110000000"
+ "0000001111111111111111111111111111111111111111111111111111000000"
+ "0000011111111111111111111111111111111111111111111111111111100000"
+ "0000011111111111111111111111111111111111111111111111111111110000"
+ "0000111111111111111111111111111111111111111111111111111111110000"
+ "0001111111111111111111111111111111111111111111111111111111111000"
+ "0000011111111111111111111111111111111111111111111111111111111000"
+ "0000000111111111111000100111111111111110001010111111111111100000"
+ "0011000001111111110010001111111111111110100000001111111100000000"
+ "0011110000011111000110100011111111111111101101100101100000001100"
+ "0111111100000100011100111001111111111101001000110000000001111110"
+ "0111111111000001001001101100011111111101101111100100001111111110"
+ "0111111111111011011100000111001111111000100100001110111111111110"
+ "0111111111000001000111011100011111111010111110100010010111111110"
+ "1111111111110111010010010001001111110010010000110111000111111111"
+ "1111111111100010010110111011101111010111011110011100010111111111"
+ "1111111111101111110111100001001010000101001011110001110111111111"
+ "1111111111100000100100111011100010101101101001000100100111111111"
+ "1111111111110110111101101110001011100000111101011111101111111111"
+ "1111111111100011100100100011101001110111100101110001000111111111"
+ "1111111111111000001101110110111011000001001101100100010111111111"
+ "1111111111111101101000010100001010010101101000110110111111111111"
+ "1111111111110001111101010101011110110100101110011100011111111111"
+ "1111111111111010010001110001111000100110000100110001111111111111"
+ "1111111111111111000111000101101101101100101110100100111111111111"
+ "1111111111111111110001011111100000111111100010001111111111111111"
+ "0111111111111111100100001111101011111111111000100111111111111110"
+ "0111111111111111111111111111111000011111111111111111111111111110"
+ "0111111111111111111111111111010010111111111111111111111111111110"
+ "0111111111111111111111111101000111111111111111111111111111111110"
+ "0011111111111111111111111100010001111111111111111111111111111100"
+ "0011111110011111111111111111110111111111111111111111111111111100"
+ "0001111111010111111111111111100011111111111111111111101111111000"
+ "0001111111000100011111111111001011111111111011111010000111111000"
+ "0001111111010101001010001101011001010010110001100000101111111000"
+ "0000111111110001100000100000001100011000000101001110111111110000"
+ "0000011111110100111101111011100111000011101111101011111111100000"
+ "0000011111111110100100100010111101110110100001100011111111100000"
+ "0000001111111100001101101000010001010000111010001111111111000000"
+ "0000000111111111011000111110110101000101100011111111111110000000"
+ "0000000111111111001110010100011100010111001000111111111110000000"
+ "0000000011111111100011110001110110111101111011111111111100000000"
+ "0000000001111111110110000101000000100001011111111111111000000000"
+ "0000000000111111111111010111101101101011001111111111110000000000"
+ "0000000000011111111111110000111100001000011111111111100000000000"
+ "0000000000000111111111111111111110111111111111111110000000000000"
+ "0000000000000011111111111111111111111111111111111100000000000000"
+ "0000000000000000111111111111111111111111111111110000000000000000"
+ "0000000000000000011111111111111111111111111111100000000000000000"
+ "0000000000000000000011111111111111111111111100000000000000000000"
+ "0000000000000000000000111111111111111111110000000000000000000000"
+ "0000000000000000000000000011111111111100000000000000000000000000";
Scanner sc = new Scanner(System.in);
int y = sc.nextInt();
int x = sc.nextInt();
System.out.println(s.charAt(x + y*64) == '1'?"IN":"OUT");
}
}
F
分析:
用化学元素周期表构成字符串
可以yes
不可以no
AC代码:
import java.util.*;
public class F {
public static HashSet<String> set;
public static String str;
public static int[] dp;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
set = new HashSet<>();
String[] arr = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl",
"Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se",
"Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb",
"Te", "I", "Xe", "Cs", "Ba", "La", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb",
"Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ce", "Pr", "Nd", "Pm",
"Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm",
"Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh",
"Fl", "Mc", "Lv", "Ts", "Og" };
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i].toUpperCase();
set.add(arr[i]);
}
str = s.next();
str = str.toUpperCase();
dp = new int[str.length()];
for (int i = 0; i < dp.length; i++) {
dp[i] = -1;
}
System.out.println(pos(0)?"YES":"NO");
}
public static boolean pos(int i) {
int n = str.length();
if (i == n)
return true;
if (dp[i] == 1)
return true;
if (dp[i] == 0)
return false;
for (int j = i + 1; j <= n; j++) {
String temp = str.substring(i, j);
if (set.contains(temp)) {
boolean val = pos(j);
if (val) {
dp[i] = 1;
return true;
}
}
}
return false;
}
}
还没有评论,来说两句吧...