最近一两天做CF的April Fool Contest
感觉非常好玩 实力浪费人生
A. Mysterious numbers - 1
把第二个数字倒一下加上第一个就可以了
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int main(){ int a=IN(),b=IN(),cnt; char c[29]; cnt=sprintf(c,"%d",b); reverse(c,c+cnt); sscanf(c,"%d",&b); OUT(a+b); }
B. Star
题意就是求像图中那样的$n$层的star由几个球构成
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int main(){ int n=IN(),Ans=1; Rep(i,1,n-1) Ans+=i*12; OUT(Ans); }
C. A Piece of Cake
给跪了……这坨不知道在干啥像烹饪指南一样的东西,
原来是一个叫Chef的编程语言……
意思就是算$\sum_{i=0}^n{i*a_i}$
打个差不多意思的代码就好了。。
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int main(){ int Ans=0,Cnt=0,n; while (~scanf("%d",&n)) Ans+=n*Cnt++; OUT(Ans); }
D. Broken checker
还是给跪了……人力二分
题意就是总共5个点,$1 \sim 5$ 每个数字对应一个答案,
答案的范围是 $1 \sim 3$
我是这样的:
第一次:如果输入>3就让它RE,如果<3就让它TLE,否则输出1
然后直接TLE 2了~非常开森 说明3的答案是1
第二次:输入3就输出1(类似的下面全部省略)如果>3直接RE
如果=2直接MLE,如果是1输出3
然后WA2 说明第二个点输入是1,且1的答案不是3
第三次:输入1输出2,如果输入5输出3,
如果输入4直接RE,如果输入2就MLE
然后RE3 说明1的答案是2,第三个点输入是4
第四次、第五次:枚举了一下4输出1或输出3全都WA3了,说明4的答案是2
第六次:如果输入5输出3,如果输入2就RE
然后RE4,说明第四个点是2
第七次:输入2就输出3,否则就是输入5,也输出3
然后WA5,说明2的答案是3,5的答案不是3
第八次:输入5输出2,WA5,说明5的答案是1
第九次:Accept(热泪盈眶)
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int n; int main(){ n=IN(); if (n==3) return puts("1"),0; if (n==1) return puts("2"),0; if (n==4) return puts("2"),0; if (n==2) return puts("3"),0; if (n==5) return puts("1"),0; }
E. MYSTERIOUS LANGUAGE
猜语言并且用那种语言编程输出它的名字……
讲道理直接CE一次看编译信息百度就好了
然后不想猜了直接看了题解
题解说是INTERCAL(什么鬼东西)
这题好像萎一点直接用C++输出就好了
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int main(){ puts("INTERCAL"); }
F. ucyhf
这题题面加密了一下
比较简单,每个字母向左移10位就可以了
直接放题面咯:
an emirp is a prime number whose reverse is a different prime number. your task is to find the nth emirp.
the input consists of a single integer n (1 ≤ n ≤ 11184) — the one-based index of the emirp to find.
output a single number.
筛一筛然后乱搞一下就好了
最大的是999983所以只处理出小于1000000的就可以了
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } const int N=1000000; int Mn[N+5],P[100000],Cnt; char s[100]; int main(){ Rep(i,2,N){ if (!Mn[i]) P[Mn[i]=++Cnt]=i; Rep(j,1,Cnt){ if (i*P[j]>N) break; Mn[i*P[j]]=j; if (j==Mn[i]) break; } } int n=IN(),Nw=0; Rep(i,1,Cnt){ int len=sprintf(s,"%d",P[i]),Tmp; reverse(s,s+len); sscanf(s,"%d",&Tmp); if (Tmp==P[i]) continue; int pos=lower_bound(P+1,P+Cnt+1,Tmp)-P; if (P[pos]==Tmp){ Nw++; if (Nw==n) return OUT(P[i]),0; } } }
G. Mysterious numbers - 2
又是看样例猜题意系列……
$a1和a2$是一个类Fibonacci数列的第0项和第1项
求第$a3$项
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } int a[25]; int main(){ a[0]=IN(),a[1]=IN(); int Xs=IN(); Rep(i,2,Xs) a[i]=a[i-1]+a[i-2]; OUT(a[Xs]); }
H. A polyline
题意就是求 $a$ 阶希尔伯特曲线从左下角开始走,走 $b$ 步的空间坐标位置
我们发现,如果把 $a$ 阶希尔伯特曲线分成4个 $a-1$ 阶的,遍历顺序是这样的:
然后如果 $a-1$ 阶再分成四块,遍历顺序是这样的:
然后 $a-2$ 阶和 $a$ 阶是一样的,以此类推。
于是可以分治。
一开始假设阶数都是偶数,做起来比较方便。
如果是奇数的话最后横纵坐标交换一下就好了。
我们定义一个类型为 $pair<int,int>$ 的函数$Solve(a,b)$,
表示在 $a$ 阶曲线上走 $b$ 步的坐标
首先把遍历四块中一块的步数算出来称为$step$,如果$b<step$,
那么说明在左下角,直接返回$Solve(a-1,b)$
否则如果$b<2*step$,先计算出$Solve(a-1,b-step)$,
再根据 $a$ 的奇偶性决定它在左上角还是左下角
否则的话,我们发现遍历的第一第二块和第三第四块是对称的,
那么我们就可以当做它从最终所在坐标开始往回走。
先计算出$Solve(a,4*step-1-b)$,然后根据 $a$ 的奇偶性减一下就好了。
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define PII pair<int,int> #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } PII Solve(int Cs,int Nb){ if (Cs==1){ if (Nb==0) return mk(0,0); if (Nb==1) return mk(1,0); if (Nb==2) return mk(1,1); if (Nb==3) return mk(0,1); } int Zs=1<<2*Cs,Sf=Zs/4,Md=1<<Cs-1; if (Nb<Sf) return Solve(Cs-1,Nb); if (Nb<2*Sf){ PII Res=Solve(Cs-1,Nb%Sf); if (Cs&1) return mk(Res.sc+Md,Res.fr); else return mk(Res.sc,Res.fr+Md); } PII Res=Solve(Cs,Zs-1-Nb); if (Cs&1) return mk(Res.fr,(Md<<1)-1-Res.sc); else return mk((Md<<1)-1-Res.fr,Res.sc); } int main(){ int a=IN(),b=IN(); PII Ans=Solve(a,b); if (a&1) swap(Ans.fr,Ans.sc); OUT(Ans.fr),putchar(' '),OUT(Ans.sc); }
A. The Great Game
啦啦啦 石头剪刀布 看谁赢得多
8< 是剪刀 ()是石头 []是布
#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define Rep(x,a,b) for (int x=a;x<=b;x++) #define Drp(x,a,b) for (int x=a;x>=b;x--) #define Cross(x,a) for (int x=head[a];~x;x=next[x]) #define ll long long #define INF (1<<29) #define mk(a,b) make_pair(a,b) #define fr first #define sc second using namespace std; inline ll IN(){ ll x=0;int ch=getchar(),f=1; while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar(); if (ch=='-'){f=-1;ch=getchar();} while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return x*f; } inline void OUT(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) OUT(x/10),putchar(x%10+'0'); else putchar(x+'0'); } char a[25],b[25]; int Ans,la,lb; int main(){ scanf("%s",&a);scanf("%s",&b); int len=strlen(a); for (int i=0;i<len;i+=2){ if (a[i]=='8') la=0;if (a[i]=='(') la=1;if (a[i]=='[') la=2; if (b[i]=='8') lb=0;if (b[i]=='(') lb=1;if (b[i]=='[') lb=2; Ans+=((la-lb+1)%3-2)%3+1; } if (Ans>0) puts("TEAM 1 WINS"); if (Ans<0) puts("TEAM 2 WINS"); if (Ans==0) puts("TIE"); }
写不动了不写了不写了
Aug 18, 2022 03:15:45 AM
TS SSC Question Paper 2023 Download Telangana 10th Class Exam New Model Paper 2023, Telangana TS SSC 10th Class Question Paper 2023 Download official website bsetelangana.org, TS 10th class exam final public Previous Question Paper 2023, Telangana 10th Class Model Paper 2023 PDF Telangana Board of Secondary Education has been released their academic year 2023 Previous Question Paper on their official website bsetelangana.org in the month of November 2023.
Apr 16, 2023 06:40:36 PM
We provide you the finest of web content on each and every topics possible with help of editorial and content team.Jnanabhumi AP is a startup by passionate webmasters and bloggers who have passion to provide engaging content which is accurate, interesting and worthy to read. We are mope like a web community where you can jnanabhumiap.in find different information’s, resources, topics on day to day incidents or news.