跳到正文

个人记录

2024CSP-S代码迷惑行为大赏(FJ)

complete_binary_tree约 15 分钟
原文
文章信息与版本

文章信息

发布
2024年10月28日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 15 分钟
获赞
2

版本

  1. v1当前

老生常谈的 freopen

我们在 6,2456,245 个文件中找到了 12,57712,577 个 freopen.居然是个奇数

(不过有些同学喜欢 #define fo freopen,奇数个倒也没啥问题)

然后就是 //freopen,找到 8080 个文件中 140140 个结果.

  • FJ-S00035/duel.cpp
C++
int main(){
	freopen("duel4.in", "r", stdin);
	//freopen("duel.out", "w", stdout);

不仅注释了 freopen,而且前面那一个还是 "duel4.in".

  • FJ-S00148/color.cpp
C++
int main() {
	freopen("color.in", "r", stdin);
	freopen("color.out", "w", stdout);
  ...(接下来是n^2暴力)
}
//#include<bits/stdc++.h>
//#include<queue>
//using namespace std;
...
//int main(){
//	//freopen("color.in", "r", stdin);
//	//freopen("color.out", "w", stdout);
    ...(一个被注释掉的做法,可能作者忘删了?)
}

这段代码中出现了两个 freopen 和两个 //freopen,终于知道为什么 freopen 会比源文件个数多出一倍以上了.

  • FJ-S00215/duel.cpp
C++
int main(){
	freopen("1.in","r",stdin);
	//freopen("duel.out","w",stdout);

同 00035.

  • FJ-S00241
C++
int main(){
	memset(g,INT_MAX-1,sizeof(g));
	freopen("duel1.in","r",stdin);//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	//freopen("duel.out","w",stdout);//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

他甚至加了感叹号来提醒自己.不过还是卒了.

值得一提的是,他在代码开头中写了如下文字:

C++
/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */

这名选手的文件是 mingw-w64 运行文件的一部分.

为什么不放文件名?因为他四个文件都一样.

  • FJ-S00289/arena.cpp

这名选手好像想说什么,不过可能在编码转换的时候他的信息丢失了.(可能是分数下限和分数上限?)

C++
int main(){
	freopen("arena.in","r",stdin);
	freopen("arena.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	//i have no time to solve t4
	//freopen
	//Ԥ��75+40+20=135
	//����100+40+20=160
	//Highscore rp++
	//Time Leaper by Hinkik 
	//����t1�� 
	return 0;
}
  • FJ-S00628
C++
#include<bits/stdc++.h>
using namespace std;
long long a[1000000];//���޵Ĺ����ͷ��� ������������ 
int main(){
	//freopen("duel,in","r",stdin);
	//freopen("duel,out","w",stdout);
	long long n;
	scanf("%d",&n);//������� 
	int sum=0;
	for(long long i=1;i<=n;i++)
	{
		scanf("%d",&a[i]); //������޵����� 
	}
	sort(a+1,a+1+n);//����ÿ�����޵����� 
	for(long long i=n;i>=1;i--)
	{
		if(a[i]>a[i-1])
		sum++;//��û���ֵľͼӼ� 
	
	}
	printf("%d",n-sum);
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

乱码+1.

而且还是 "duel,in".

  • FJ-S00658/duel.cpp
C++
#include<bits/stdc++.h>
using namespace std;
int main() {
	//freopen("duel.in","r",stdin);
	//freopen("duel.out","w",stdout);
	int n,c=0,b=0;
	cin>>n;
	int a[n+5];
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	if(n==5&&a[1]==1&&a[2]==2&&a[3]==3&&a[4]==1&&a[5]==2) {
		cout<<2;
	}
	if(n==10&&a[1]==136&&a[2]==136&&a[3]==136&&a[4]==2417&&a[5]==136&&a[6]==136&&a[7]==2417&&a[8]==136&&a[9]==136&&a[10]==136) {
		cout<<8;
	}
	for(int i=1; i<=n; i++) {
		if(a[i]!=1&&a[i]!=2) b=1;
	}
	if(b==0) cout<<65376;
	for(int i=2; i<=n; i++) {
		if(a[i]!=a[i-1]) c=1;
	}
	if(c==0) cout<<n;
	return 0;
}

输出样例人.

  • FJ-S00664/color.cpp

映入眼帘的是 11,550B11,550\text{B} 的超长代码.

仔细一看:

C++
signed main()
{
	//freopen("color.in","r",stdin);
	//freopen("color.out","w",stdout);
    ...
	while(T--)
	{
		if(n==2)
		{
            ...
		}
		if(n==3)	
		{
            ...
		}
        ...
		if(n==15)
		{

			for(int i1=0;i1<2;i1++)
			for(int i2=0;i2<2;i2++)
			for(int i3=0;i3<2;i3++)
			for(int i4=0;i4<2;i4++)
			for(int i5=0;i5<2;i5++)
			for(int i6=0;i6<2;i6++)
			for(int i7=0;i7<2;i7++)
			for(int i8=0;i8<2;i8++)
			for(int i9=0;i9<2;i9++)
			for(int i10=0;i10<2;i10++)
			for(int i11=0;i11<2;i11++)
			for(int i12=0;i12<2;i12++)
			for(int i13=0;i13<2;i13++)
			for(int i14=0;i14<2;i14++)
			for(int i15=0;i15<2;i15++)
			{answer=0;int k1=0,k2=0;
				c[0]=i1;
				c[1]=i2;
				c[2]=i3;
				c[3]=i4;
				c[4]=i5;
				c[5]=i6;
				c[6]=i7;
				c[7]=i8;
				c[8]=i9;
				c[9]=i10;
				c[10]=i11;
				c[11]=i12;
				c[12]=i13;
				c[13]=i14;
				c[14]=i15;
				for(int i=0;i<15;i++)
				{
					if(c[i]==0)
					{
						r[k1]=a[i];
						k1++;
					}
					else if(c[i]==1)
					{
						b[k2]=a[i];
						k2++;
					}
				}
				for(int i=0;i<k1-1;i++)
				{
					if(r[i]==r[i+1])
					{
						answer+=r[i];
					}
				}
				for(int i=0;i<k2-1;i++)
				{
					if(b[i]==b[i+1])
					{
						answer+=b[i];
					}
				}maxn=max(maxn,answer);
			}	
			cout<<maxn<<endl;
		}
    }
	return 0;
}

不会写递归的孩纸.

  • FJ-S00732/arena.cpp
C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("arena.in","r",stdin);
	//freopen("arena.out","w",stdout);
	cout<<5<<endl;
	cout<<19<<endl;
	cout<<7<<endl;
	cout<<1;
	return 0;
}

输出样例仙人.

  • FJ-S00831/color.cpp

又一位.

C++
int main(){
	freopen("color2.in","r",stdin);
	//freopen("color.out","w",stdout);
  • FJ-S00863

乱码仙人+1.

C++
//����̰��
//����������
//�����������
//���ڹ������ͷ�����һ��
//����������
//�ִ�
//Ҫ�Ӷ���?
//�Ҳ����Ϳ���ֹͣ 
//nlogn+

还是宏定义大神.

C++
#ifndef JYF
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
#endif
  • FJ-S00921/detect.cpp

反过来了.

C++
int main()
{
	//freopen("detect1.in","r",stdin);
	freopen("detect.out","w",stdout);
  • FJ-S00940/duel.cpp

我们在该选手的代码中发现了两份被注释的代码和一份输出样例的代码.可能是条弘文了所致.

  • FJ-S01153/color.cpp

惊现 17,066B17,066\text B 代码!

原来是把样例附上了,那没事了.

除此之外,这位同学也有什么想说的:

C++
/*
(前面是大样例)
����ٱ�ը�Ϳ���׼�������� 

��ֹ��Ϊ���һ�ε���û�������һ��

//freopen("AFO.in", "r", stdin);

��лcxy��ǰ��æ������̬�����ڸ������ţ��ٵģ� 

ϣ����Ҫ�ҷ�

��������̫�����

ȥ��Ҳ��60����

��CCF����2000�ˣ���Ը�лر�
*/
  • FJ-S01168
C++
//��עNuclear_Fish_cyqлл����1����J��(FJ-J01605)������࣡��1

乱码仙人+1.(可能是为了推销他洛谷号?可以找到 Nuclear_Fish_cyq.)

  • FJ-S1280
C++
//You're right but Genshin is invented by Hihuyo in Shanghai.
//Keqing is really beautiful!!
//sto QWQ_SenLin orz
//T4 is too difficult for me to get any scores.
//It's truly a bad thing.
//But Keqing is really pretty!!

发现原神玩家*1.

但是 Keqing\text{Keqing} 是谁呢?


发现一车神秘 #define 人:

C++
#define F(ss) freopen(#ss".in","r",stdin),freopen(#ss".out","w",stdout)

代码长度

我们发现了最长代码:490.0KB490.0\text{KB}!(FJ-S00332/detect.cpp)

他在代码中定义了一个 bool findsomething[100000]={true,true,...,true}。

本来以为这个数组会有一些不一样的东西,但是替换大法发现没有。

第二长的是 92.3KB92.3\text{KB}(FJ-00104/arena.cpp)

他在代码中放了亿点点换行符,让他的代码有 4708447084 行。

还有 FJ-S00208/color.cpp。

他在代码中放了许多抽象画作,这里挑几个展示:

C++
/*
 ._________________. 
 | _______________ | 
 | I             I | 
 | I             I | 
 | I             I | 
 | I             I | 
 | I_____________I | 
 !_________________! 
    ._[_______]_. 
.___|___________|___. 
|::: ____           | 
|    ~~~~ [CD-ROM]  | 
!___________________!

  ,--.      <__)
  `- |________7
     |`.      |\
  .--|. \     |.\--.
 /   j \ `.7__j__\  \
|   o   | (o)____O)  |
 \     /   J  \     /
  `---'        `---'
       (_\
      / \
 `== / /\=,_
  ;--==\\  \\o
  /____//__/__\
@=`(0)     (0) 
 -------- __@      __@       __@       __@      __~@
 ----- _`\<,_    _`\<,_    _`\<,_     _`\<,_    _`\<,_
 ---- (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)
 -------- __@      __@       __@       __@      __~@
 ----- _`\<,_    _`\<,_    _`\<,_     _`\<,_    _`\<,_
 ---- (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)
 -------- __@      __@       __@       __@      __~@
 ----- _`\<,_    _`\<,_    _`\<,_     _`\<,_    _`\<,_
 ---- (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)  (*)/ (*)
 -------- __@  
 ----- _`\<,_  
 ---- (*)/ (*) 
*/

FJ-S00578/arena.cpp

这个文件竟然是二进制文件?

在其中找到了 Microsoft 字眼,还有一个路径:

代码
C:\Program Files (x86)\Microsoft Office\Visio11\2052\BASFLO_M.VST

推测是 office 的某个小组件。

原文