April Fools Day Contest 2020
愚人节专场fucking high♂(tourist59minAK ?!?!!Orz
A.Is it rated?
唯一一道我没wa tourist wa一发 的题。。。
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout << "No" << endl;
return 0;
}
B.Limericks
There was once young lass called Mary,
Whose jokes were occasionally scary.
On this April's Fool
Fixed limerick rules
Allowed her to trip the unwary.
Can she fill all the lines
To work at all times?
On juggling the words
Right around two-thirds
She nearly ran out of rhymes.
Input
The input contains a single integer aa (4≤a≤9984≤a≤998). Not every integer in the range is a valid input for the problem; you are guaranteed that the input will be a valid integer.
Output
Output a single number.
Examples
35
57
57
319
391
1723
就是第一个因数和原数与它的商
#include<bits/stdc++.h> typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef double lf; typedef long double llf; typedef std::pair<int,int> pii; #define xx first #define yy second template<typename T> inline T max(T a,T b){return a>b?a:b;} template<typename T> inline T min(T a,T b){return a<b?a:b;} template<typename T> inline T abs(T a){return a>0?a:-a;} template<typename T> inline bool repr(T &a,T b){return a<b?a=b,1:0;} template<typename T> inline bool repl(T &a,T b){return a>b?a=b,1:0;} template<typename T> inline T gcd(T a,T b){T t;if(a<b){while(a){t=a;a=b%a;b=t;}return b;}else{while(b){t=b;b=a%b;a=t;}return a;}} template<typename T> inline T sqr(T x){return x*x;} #define mp(a,b) std::make_pair(a,b) #define pb push_back #define I __attribute__((always_inline))inline #define mset(a,b) memset(a,b,sizeof(a)) #define mcpy(a,b) memcpy(a,b,sizeof(a)) #define fo0(i,n) for(int i=0,i##end=n;i<i##end;i++) #define fo1(i,n) for(int i=1,i##end=n;i<=i##end;i++) #define fo(i,a,b) for(int i=a,i##end=b;i<=i##end;i++) #define fd0(i,n) for(int i=(n)-1;~i;i--) #define fd1(i,n) for(int i=n;i;i--) #define fd(i,a,b) for(int i=a,i##end=b;i>=i##end;i--) #define foe(i,x)for(__typeof((x).end())i=(x).begin();i!=(x).end();++i) #define fre(i,x)for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i) struct Cg{I char operator()(){return getchar();}}; struct Cp{I void operator()(char x){putchar(x);}}; #define OP operator #define RT return *this; #define UC unsigned char #define RX x=0;UC t=P();while((t<'0'||t>'9')&&t!='-')t=P();bool f=0;\ if(t=='-')t=P(),f=1;x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0' #define RL if(t=='.'){lf u=0.1;for(t=P();t>='0'&&t<='9';t=P(),u*=0.1)x+=u*(t-'0');}if(f)x=-x #define RU x=0;UC t=P();while(t<'0'||t>'9')t=P();x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0' #define TR *this,x;return x; I bool IS(char x){return x==10||x==13||x==' ';}template<typename T>struct Fr{T P;I Fr&OP,(int&x) {RX;if(f)x=-x;RT}I OP int(){int x;TR}I Fr&OP,(ll &x){RX;if(f)x=-x;RT}I OP ll(){ll x;TR}I Fr&OP,(char&x) {for(x=P();IS(x);x=P());RT}I OP char(){char x;TR}I Fr&OP,(char*x){char t=P();for(;IS(t);t=P());if(~t){for(;!IS (t)&&~t;t=P())*x++=t;}*x++=0;RT}I Fr&OP,(lf&x){RX;RL;RT}I OP lf(){lf x;TR}I Fr&OP,(llf&x){RX;RL;RT}I OP llf() {llf x;TR}I Fr&OP,(uint&x){RU;RT}I OP uint(){uint x;TR}I Fr&OP,(ull&x){RU;RT}I OP ull(){ull x;TR}};Fr<Cg>in; #define WI(S) if(x){if(x<0)P('-'),x=-x;UC s[S],c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0') #define WL if(y){lf t=0.5;for(int i=y;i--;)t*=0.1;if(x>=0)x+=t;else x-=t,P('-');*this,(ll)(abs(x));P('.');if(x<0)\ x=-x;while(y--){x*=10;x-=floor(x*0.1)*10;P(((int)x)%10+'0');}}else if(x>=0)*this,(ll)(x+0.5);else *this,(ll)(x-0.5); #define WU(S) if(x){UC s[S],c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0') template<typename T>struct Fw{T P;I Fw&OP,(int x){WI(10);RT}I Fw&OP()(int x){WI(10);RT}I Fw&OP,(uint x){WU(10);RT} I Fw&OP()(uint x){WU(10);RT}I Fw&OP,(ll x){WI(19);RT}I Fw&OP()(ll x){WI(19);RT}I Fw&OP,(ull x){WU(20);RT}I Fw&OP() (ull x){WU(20);RT}I Fw&OP,(char x){P(x);RT}I Fw&OP()(char x){P(x);RT}I Fw&OP,(const char*x){while(*x)P(*x++);RT} I Fw&OP()(const char*x){while(*x)P(*x++);RT}I Fw&OP()(lf x,int y){WL;RT}I Fw&OP()(llf x,int y){WL;RT}};Fw<Cp>out; int main() { int a=in; fo(i,2,a-1) { while(a%i==0) { out,i; a/=i; } } }
C....And after happily lived ever they
Input
The input contains a single integer a (0≤a≤63)
Output
Output a single number.
Examples
2
2
5
24
35
50
题目强调范围是 0 - 63 ,64 = 2 ^ 6 ,而标题刚好是 6 个单词。
观察发现标题语序是错乱的,正确的顺序是 And they lived happily ever after。
二进制重排!
/** * author: tourist * created: 01.04.2020 17:50:41 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a; cin >> a; vector<int> b(6); for (int i = 0; i < 6; i++) { b[i] = (a >> i) & 1; } vector<int> c(6); c[4] = b[0]; c[1] = b[1]; c[3] = b[2]; c[2] = b[3]; c[0] = b[4]; c[5] = b[5]; int d = 0; for (int i = 0; i < 6; i++) { d |= (c[i] << i); } cout << d << '\n'; return 0; }
D.Again?
Input
The only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.
Output
Output a single integer.
Examples
A278832
0
A089956
0
A089957
1
A144045
1
没啥好说的,看最后一个数的奇偶性
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; cout << (s.back() % 2) << '\n'; return 0; }
E.Jordan Smiley
Input
The input contains two integers rowrow, colcol (0≤row,col≤630≤row,col≤63), separated by a single space.
Output
Output "IN" or "OUT".
Examples
0 0
OUT
27 0
IN
0 27
OUT
27 27
IN
见评论区
#include <bits/stdc++.h> using namespace std; vector<string> s = { " # # ###### # ", " # ### # # # # ##### ", " ### # # ## # # # ", " #### # # ##### #### # ### # ", " ## # # #### # # # ## ", " # ## ##### ### ### # # ## # # # ", " ### # # # # #### ## ## ## ## ", " ###### ## ## ### ### ### ## # # ### ", " ############ # # # ## ## ## # ### ", " #################### ####### #### ########## ", " ################################################ ", " ################################################## ", " ################################################## ", " #################################################### ", " ###################################################### ", " ###################################################### ", " ######################################################## ", " ########################################################## ", " ######################################################## ", " ############ # ############## # # ############# ", " ## ######### # ############### # ######## ", " #### ##### ## # ############### ## ## # ## ## ", " ####### # ### ### ########### # # ## ###### ", " ######### # # ## ## ######### ## ##### # ######### ", " ############ ## ### ### ####### # # ### ########### ", " ######### # ### ### ######## # ##### # # # ######## ", "############ ### # # # # ###### # # ## ### #########", "########### # # ## ### ### #### # ### #### ### # #########", "########### ###### #### # # # # # # #### ### #########", "########### # # ### ### # # ## ## # # # # #########", "############ ## #### ## ### # ### #### # ###### ##########", "########### ### # # ### # ### #### # ### # #########", "############# ## ### ## ### ## # ## ## # # #########", "############## ## # # # # # # # ## # ## ## ############", "############ #### # # # # #### ## # # ### ### ###########", "############# # # ### #### # ## # ## #############", "################ ### # ## ## ## ## # ### # # ############", "################## # ###### ####### # ################", " ################ # ##### # ########### # ############## ", " ############################## ############################ ", " ########################### # # ############################# ", " ######################### # ################################ ", " ######################## # ############################# ", " ####### ################### ############################### ", " ####### # ################ ##################### ####### ", " ####### # ########### # ########### ##### # ###### ", " ####### # # # # # ## # ## # # # ## ## # ####### ", " ######## ## # ## ## # # ### ######## ", " ####### # #### #### ### ### ### ##### # ######### ", " ########## # # # # #### ### ## # # ######### ", " ######## ## ## # # # # ### # ########## ", " ######### ## ##### ## # # # ## ############# ", " ######### ### # # ### # ### # ########### ", " ######### #### ### ## #### #### ############ ", " ######### ## # # # # ############## ", " ############ # #### ## ## # ## ############ ", " ############# #### # ############ ", " #################### ################# ", " #################################### ", " ################################ ", " ############################## ", " ######################## ", " #################### ", " ############ "}; int main() { ios::sync_with_stdio(false); cin.tie(0); int r, c; cin >> r >> c; cout << (s[r][c] == '#' ? "IN" : "OUT") << '\n'; return 0; }
F.Elementary!
The input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.
OutputOutput "YES" or "NO".
ExamplesGENIUS
YES
DOCTOR
NO
IRENE
YES
MARY
NO
SMARTPHONE
NO
REVOLVER
YES
HOLMES
NO
WATSON
YES
/** * author: tourist * created: 01.04.2020 17:41:16 **/ #include <bits/stdc++.h> using namespace std; vector<string> els = {"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","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","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"}; int main() { ios::sync_with_stdio(false); cin.tie(0); for (string& x : els) { if (x.size() == 2) { x[1] = (char) toupper(x[1]); } } string s; cin >> s; vector<bool> dp(s.size() + 1); dp[0] = true; for (int i = 0; i < (int) s.size(); i++) { if (dp[i]) { for (string w : els) { if (s.substr(i, w.size()) == w) { dp[i + (int) w.size()] = true; } } } } cout << (dp.back() ? "YES" : "NO") << '\n'; return 0; }
G.Lingua Romana
per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis
per nextum in unam tum XI conscribementis fac sic
seqis decumulamenta da varo.
varum privamentum fodementum da aresulto.
varum tum III elevamentum tum V multiplicamentum da bresulto.
aresultum tum bresultum addementum da resulto.
si CD tum resultum non praestantiam fac sic
dictum sic f(%d) = %.2f cis tum varum tum resultum egresso describe.
novumversum egresso scribe.
cis
si CD tum resultum praestantiam fac sic
dictum sic f(%d) = MAGNA NIMIS! cis tum varum egresso describe.
novumversum egresso scribe.
cis
cis
Input
The input consists of several integers, one per line. Each integer is between -50 and 50, inclusive.
Output
As described in the problem statement.
Example
0 1 -2 -3 -4 -5 -6 -7 -8 -9 10
f(10) = MAGNA NIMIS! f(-9) = -3642.00 f(-8) = -2557.17 f(-7) = -1712.35 f(-6) = -1077.55 f(-5) = -622.76 f(-4) = -318.00 f(-3) = -133.27 f(-2) = -38.59 f(1) = 6.00 f(0) = 0.00
拉丁文翻译一下大致是输入11个数,函数跟5,3有关,当这个函数值大于400时输出“MAGNA NIMIS”!
可以发现f(n) = 5 * n^3 +abs(n)^0.5
/** * author: tourist * created: 01.04.2020 18:09:47 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); vector<int> as(11); for (int i = 0; i < 11; i++) { cin >> as[i]; } cout << fixed << setprecision(2); for (int i = 10; i >= 0; i--) { int v = as[i]; double a = sqrt(abs(v)); double b = v * v * v * 5; double res = a + b; if (res > 400) { cout << "f(" << v << ") = MAGNA NIMIS!" << '\n'; } else { cout << "f(" << v << ") = " << res << '\n'; } } return 0; }
H.It's showtime
You are given a mysterious language (codenamed "UnknownX") available in "Custom Test" tab. Find out what this language is, and use it to solve the following problem.
You are given an integer input=1000∗n+modinput=1000∗n+mod (1≤n,mod≤9991≤n,mod≤999). Calculate double factorial of n modulo modmod.
Input
The input contains a single integer inputinput (1001≤input≤9999991001≤input≤999999). You are guaranteed that inputmod1000≠0inputmod1000≠0.
Output
Output a single number.
Examples
6100
48
9900
45
100002
0
123456
171
Note
In the first test case you need to calculate 6!!mod1006!!mod100; 6!!=6∗4∗2=486!!=6∗4∗2=48.
In the second test case you need to calculate 9!!mod9009!!mod900; 9!!=9∗7∗5∗3=9459!!=9∗7∗5∗3=945.
In the third test case you need to calculate 100!!mod2100!!mod2; you can notice that 100!!100!! is a multiple of 100 and thus is divisible by 2.
现学一门语言。。。
IT'S SHOWTIME HEY CHRISTMAS TREE x YOU SET US UP @NO PROBLEMO HEY CHRISTMAS TREE n YOU SET US UP @NO PROBLEMO HEY CHRISTMAS TREE md YOU SET US UP @NO PROBLEMO HEY CHRISTMAS TREE tmp YOU SET US UP @NO PROBLEMO HEY CHRISTMAS TREE flag YOU SET US UP @NO PROBLEMO HEY CHRISTMAS TREE res YOU SET US UP @NO PROBLEMO GET YOUR ASS TO MARS x DO IT NOW I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY GET TO THE CHOPPER n HERE IS MY INVITATION x HE HAD TO SPLIT 1000 ENOUGH TALK GET TO THE CHOPPER tmp HERE IS MY INVITATION n YOU'RE FIRED 1000 ENOUGH TALK GET TO THE CHOPPER md HERE IS MY INVITATION x GET DOWN tmp ENOUGH TALK STICK AROUND n BECAUSE I'M GOING TO SAY PLEASE flag GET TO THE CHOPPER res HERE IS MY INVITATION res YOU'RE FIRED n ENOUGH TALK YOU HAVE NO RESPECT FOR LOGIC GET TO THE CHOPPER flag HERE IS MY INVITATION 1 GET DOWN flag ENOUGH TALK GET TO THE CHOPPER tmp HERE IS MY INVITATION res HE HAD TO SPLIT md YOU'RE FIRED md ENOUGH TALK GET TO THE CHOPPER res HERE IS MY INVITATION res GET DOWN tmp ENOUGH TALK GET TO THE CHOPPER n HERE IS MY INVITATION n GET DOWN 1 ENOUGH TALK CHILL TALK TO THE HAND res YOU HAVE BEEN TERMINATED
愚人节真好VAN♂以后每年都来_(:з)∠)_