Codeforces April Fools Day Contest 2020 做题题解

童 心 未 泯

估计也不会有人看愚人节比赛题解

但是真的好好玩啊qwq


Codeforces 1331A Is it rated?

Is it rated?

No!

1
2
# Python 3
print("No")


Codeforces 1331B Limericks

$5 \times 7 = 35$.

1
2
3
4
5
6
7
8
9
// C++
#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
cin >> n;
for(int i = 2; i <= n; i++)
if(n%i==0){cout << i << n/i << endl; return 0;}
}


Codeforces 1331C …And after happily lived ever they

这就太明显了:

1
2
3
4
And they lived happily ever after
5 4 3 2 1 0
And after happily lived ever they
5 0 2 3 1 4

二进制换位.

1
2
3
4
5
6
7
8
// C++
#include <bits/stdc++.h>
using namespace std;
#define at(a,j) ((a>>j)&1)
int main(){
int a; cin >> a; cout << (at(a,5)<<5) + (at(a,4)<<0) + (at(a,3)<<2) + (at(a,2)<<3) + (at(a,1)<<1) + (at(a,0)<<4) << endl;
return 0;
}


Codeforces 1331D Again?


嗯?这也太明显了吧?一看不就是OEIS么。

(OEIS发现数列第一项对上了)

嗯?我怎么写代码?难不成还能访问网页?

(不对,一定有诈)

那只能是奇偶性了吧。

1
2
# Python 3
print(int(input()[-1])%2)


Codeforces 1331E Jordan Smiley

愚蠢的码农题?

(不对,一定有诈)















居然没有。就是愚蠢的码农题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Python 3
s = [
" # # ###### # ",
" # ### # # # # ##### ",
" ### # # ## # # # ",
" #### # # ##### #### # ### # ",
" ## # # #### # # # ## ",
" # ## ##### ### ### # # ## # # # ",
" ### # # # # #### ## ## ## ## ",
" ###### ## ## ### ### ### ## # # ### ",
" ############ # # # ## ## ## # ### ",
" #################### ####### #### ########## ",
" ################################################ ",
" ################################################## ",
" ################################################## ",
" #################################################### ",
" ###################################################### ",
" ###################################################### ",
" ######################################################## ",
" ########################################################## ",
" ######################################################## ",
" ############ # ############## # # ############# ",
" ## ######### # ############### # ######## ",
" #### ##### ## # ############### ## ## # ## ## ",
" ####### # ### ### ########### # # ## ###### ",
" ######### # # ## ## ######### ## ##### # ######### ",
" ############ ## ### ### ####### # # ### ########### ",
" ######### # ### ### ######## # ##### # # # ######## ",
"############ ### # # # # ###### # # ## ### #########",
"########### # # ## ### ### #### # ### #### ### # #########",
"########### ###### #### # # # # # # #### ### #########",
"########### # # ### ### # # ## ## # # # # #########",
"############ ## #### ## ### # ### #### # ###### ##########",
"########### ### # # ### # ### #### # ### # #########",
"############# ## ### ## ### ## # ## ## # # #########",
"############## ## # # # # # # # ## # ## ## ############",
"############ #### # # # # #### ## # # ### ### ###########",
"############# # # ### #### # ## # ## #############",
"################ ### # ## ## ## ## # ### # # ############",
"################## # ###### ####### # ################",
" ################ # ##### # ########### # ############## ",
" ############################## ############################ ",
" ########################### # # ############################# ",
" ######################### # ################################ ",
" ######################## # ############################# ",
" ####### ################### ############################### ",
" ####### # ################ ##################### ####### ",
" ####### # ########### # ########### ##### # ###### ",
" ####### # # # # # ## # ## # # # ## ## # ####### ",
" ######## ## # ## ## # # ### ######## ",
" ####### # #### #### ### ### ### ##### # ######### ",
" ########## # # # # #### ### ## # # ######### ",
" ######## ## ## # # # # ### # ########## ",
" ######### ## ##### ## # # # ## ############# ",
" ######### ### # # ### # ### # ########### ",
" ######### #### ### ## #### #### ############ ",
" ######### ## # # # # ############## ",
" ############ # #### ## ## # ## ############ ",
" ############# #### # ############ ",
" #################### ################# ",
" #################################### ",
" ################################ ",
" ############################## ",
" ######################## ",
" #################### ",
" ############ "]
a,b = [int(i) for i in input().split(' ')]; print("IN" if s[a][b] is "#" else "OUT")

(这里直接借tourist的表来用了)


Codeforces 1331F Elementary!

毫无逻辑的样例。题目名,问题一定在题目名上。















元素周期表谁想得到啊喂

双关基本演绎法可海星

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Python 3
s = ["AC", "AG", "AL", "AM", "AR", "AS", "AT", "AU", "BA", "BE", "BH", "BI",
"BK", "BR", "B", "CA", "CD", "CE", "CF", "CL", "CM", "CN", "CO", "CR",
"CS", "CU", "C", "DB", "DS", "DY", "ER", "ES", "EU", "FE", "FL", "FM",
"FR", "F", "GA", "GD", "GE", "HE", "HF", "HG", "HO", "HS", "H", "IN",
"IR", "I", "KR", "K", "LA", "LI", "LR", "LU", "LV", "MC", "MD", "MG",
"MN", "MO", "MT", "NA", "NB", "ND", "NE", "NH", "NI", "NO", "NP", "N",
"OG", "OS", "O", "PA", "PB", "PD", "PM", "PO", "PR", "PT", "PU", "P",
"RA", "RB", "RE", "RF", "RG", "RH", "RN", "RU", "SB", "SC", "SE", "SG",
"SI", "SM", "SN", "SR", "S", "TA", "TB", "TC", "TE", "TH", "TI", "TL",
"TM", "TS", "U", "V", "W", "XE", "YB", "Y", "ZN", "ZR"]
def DFS(a):
if a is "":
return "YES"
for j in s:
if (len(j)==1 and a[0]==j[0] and DFS(a[1:])=="YES") or (len(a)>=2 and len(j)==2 and a[0]==j[0] and a[1]==j[1] and DFS(a[2:])=="YES"):
return "YES"
return "NO"
ss = input()
print(DFS(ss))


Codeforces 1331G Lingua Romana

最有意思的两道题之一。

一眼就知道是拉丁语

(translate.google.cn)

什么都没有……

这时TTL告诉我,他发现了Perl的方言包(???)……

然而Codeforces上是没有这个包的。需要手动翻译。

1
2
3
4
5
6
7
8
9
10
11
// C++
#include <bits/stdc++.h>
using namespace std;
int x[12]; double a,b;
int main(){
for(int i = 1; i <= 11; i++) cin >> x[i];
for(int i = 11; i >= 1; i--){
a = sqrt(abs(x[i])), b = 5*x[i]*x[i]*x[i];
a+b <= 400 ? printf("f(%d) = %.2f\n",x[i],a+b) : printf("f(%d) = MAGNA NIMIS!\n",x[i]);
} return 0;
}


Codeforces 1331H It’s showtime

最有意思的两道题之一。

UnknownX语言。

编译一下。

WHAT THE FUCK DID I DO WRONG?

(google.com)

没啥结果

WHAT THE FUCK DID I DO WRONG programming language

(google.com)

嗯?

好吧开始现场学语言(ArnoldC)。这个语言关于如何输入介绍地很不明确,不过可以在Github Issue里搜索输入相关内容,然后可以看到一个新的Feature,进去读Feature源码就知道怎么输入了。

注意变量要开在外边。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
IT'S SHOWTIME

HEY CHRISTMAS TREE n
YOU SET US UP 0

GET YOUR ASS TO MARS n
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY


HEY CHRISTMAS TREE mod
YOU SET US UP 0
GET TO THE CHOPPER mod
HERE IS MY INVITATION n
I LET HIM GO 1000
ENOUGH TALK

GET TO THE CHOPPER n
HERE IS MY INVITATION n
GET DOWN mod
HE HAD TO SPLIT 1000
ENOUGH TALK


HEY CHRISTMAS TREE ans
YOU SET US UP 1

HEY CHRISTMAS TREE even
YOU SET US UP 0
GET TO THE CHOPPER even
HERE IS MY INVITATION n
GET UP 1
I LET HIM GO 2
ENOUGH TALK

HEY CHRISTMAS TREE now
YOU SET US UP 0


STICK AROUND n

GET TO THE CHOPPER now
HERE IS MY INVITATION n
I LET HIM GO 2
GET DOWN even
GET UP 2
I LET HIM GO 2
ENOUGH TALK

BECAUSE I'M GOING TO SAY PLEASE now
GET TO THE CHOPPER ans
HERE IS MY INVITATION ans
YOU'RE FIRED n
I LET HIM GO mod
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC

GET TO THE CHOPPER n
HERE IS MY INVITATION n
GET DOWN 1
ENOUGH TALK

CHILL

TALK TO THE HAND ans

YOU HAVE BEEN TERMINATED


比赛体验

开场网卡交不了A题;B没思路;C简直是在送;D简直是在送。

发现过B的人还不少,回来看B。

Limericks: n. 五行打油诗(幽默短诗,起始两长句押韵,中间两短句押韵,最后一长句与开头两句押韵);

(google.com)

(baidu.com)

和每个句子的单词数有关系?

还是没思路。

(OEIS.org)

Limericks?

还是没思路。

嗯?就是求一个2个因数的因数分解。

看了一眼E。愚蠢的码农题,下一个。F没思路,开G。

(复制代码,语言UnknownX,提交!)

Compilation Error

不对,G好像是拉丁语。UnknownX是H题的。搞混了。

TTL去翻译拉丁语了。我开始肝H。然后就码了大概是一个小时……

嗯,交了G和H。看F。这个F要不是别人说我还真想不出来……

比赛结束。还不错,就F不会,E不想码(一定有诈)。

等等我G呢?

G题我居然默认语言还是UnknownX。

愚人节喜提CE!


扫描二维码即可在手机上查看这篇文章,或者转发二维码来分享这篇文章:


文章作者: Magolor
文章链接: https://magolor.cn/2020/04/02/2020-04-02-blog-01/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Magolor
扫描二维码在手机上查看或转发二维码以分享Magolor的博客