跳到正文

个人记录

NOIP 2021 YN 选手经典代码大展

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

文章信息

发布
2021年11月21日
收录
2025年12月12日
更新
2026年11月18日
篇幅
约 15 分钟
获赞
5

版本

  1. v1当前

前言:

继本人上次整活CSP S 2021 第二轮 YN 选手经典代码大展,得到谷民和省友的 zici,且让本人意想不到是还被省特派员浏览到而分享到省信竟 2021 群中,再加上这次赛后本人浏览到一个了解不久的大佬(因其前一段时间的一场模拟赛及其赛后讲评直播而识)在其代码中放上了预判 YN 代码大展入展码的文字(后面的展中可见),本人想了想还是又对刚逝的 NOIP 2021 进行了整活本展――NOIP 2021 YN 选手经典代码大展。
本展即旨在对 YN 选手的经典代码进行展示,对于入展的代码及其归属选手,并无故意冒犯之意,如有介意,可私信联系以将其代码下展。

说明:

本展所有代码均采用标称+代码块的形式进行展示,其中对于代码块,第一行标记准考证号,并对准考证号进行有效数字隐末位处理,以 * 替代。例:YN-0001 示为 YN-000*,YN-0012 示为 YN-001*。

经典代码大展:

费马人

C++
YN-000*

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	freopen("sequence.in","r",stdin);
	freopen("sequence.out","w",stdout);
	
	cout<<"我想到了一个完美的解题方法"<<endl;
	cout<<"但电脑的磁盘太小了"<<endl;
	cout<<"根本写不下"<<endl;
	cout<<"干脆就不写了吧"<<endl;
	
	return 0;
}

半途而废人

C++
YN-000*

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <algorithm>
#include <ctime>
using namespace std;
int n,m,q;
struct point{
	int y;
	int x;
	int col;
	int lv;
	int rd;
	point(){
		col=-1;
	}
};

int ptn(int x,int y){
	return m*(y-1)+(x-1);
}
point ntp(int r){
	point p;
	p.x=r%m+1;
	p.y=r/m+1;
	return p;
}

int main(){
	freopen("chess.in","r",stdin);
	freopen("chess.out","w",stdout);
	srand(time(NULL));
	int TT;
	cin>>TT;
	for(int i=0;i<TT;i++){
		vector<point> vec[20010];
		
		cin>>n>>m>>q;
		/*for(int i=1;i<=n;i++){
			for(int j=1;j<=m-1;j++){
				char ch;
				scanf("%c",&ch);
				point p;
				p.x=i;
				p.y=j+1;
				p.rd=ch-'0';
				vec[ptn(j,i)].push_back(p);
				p.y=j;
				vec[ptn(j+1,i)].push_back(p);
			}
			scanf("\n");
		}
		scanf("\n");
		for(int i=1;i<=m;i++){
			for(int j=1;j<=n-1;j++){
				char ch;
				scanf("%c",&ch);
				point p;
				p.x=j;
				p.y=i+1;
				p.rd=ch-'0';
				vec[ptn(i,j)].push_back(p);
				p.y=i;
				vec[ptn(i+1,j)].push_back(p);
			}
			scanf("\n");
		}
		
		for(int i=0;i<10;i++){
			for(int j=0;j<vec[i].size();j++){
				cout<<vec[i][j].x<<" "<<vec[i][j].y<<" "<<vec[i][j].rd<<endl;
			}
			cout<<endl;
		}
		
		while (true){
			int x,y;
			cin>>x>>y;
			cout<<ptn(x,y)<<endl;
			point p=ntp(ptn(x,y));
			cout<<p.x<<" "<<p.y<<endl;
		}*/
		for(int i=0;i<q;i++){
			printf("%d\n",rand()%n+1);//不管了,写随机数; 
		}
	}
	return 0;
}

样例人

C++
YN-000*

#include <bits/stdc++.h>
using namespace std;

int a,b,c,d;

int sample(){
	cin>>a>>b>>c>>d;
	if(a==1 && b==3 && c==3 &&d==5){
		printf("4\n3\n3\n3\n2\n");
	}
	else if(a==2 && b==2 && c==3 && d==4){
		printf("3\n4\n4\n2\n5\n5\n1\n");
	}else{
		printf(
		""
		""
		""
		""
		);
	}
	return 0;
}

int interlization(){
	
	return 0;
}

int init(){
	
	return 0;
}

int test(){
	
	return 0;
}

int main(){
	freopen("chess.in","r",stdin);
	freopen("chess.out","w",stdout);
	//interlization();
	//init();
	
	sample();
	
	//test();
	return 0;
}

土块人(应yıˋng\stackrel{yìng}{应} 要yaˉo\stackrel{yāo}{要},哭笑)

C++
YN-000*

#include<bits/stdc++.h>
#define N 10010

int n;
int a[N];
long long ans;

namespace WalkerV {
	void Read() {
		scanf("%d",&n);
		for(int i=1;i<=n;i++) {
			scanf("%d",&a[i]);
		}
		return;
	}
	
	void Solve() {
		return;
	}
	
	void Print() {
		printf("0\n"); //预判!YN代码大赏——土块人 
		return;
	}
}

int main() {
	freopen("variance.in","r",stdin);
	freopen("variance.out","w",stdout);
	WalkerV::Read();
	WalkerV::Solve();
	WalkerV::Print();
	return 0;
}

样例 2 人

C++
YN-001*

#include <bits/stdc++.h>
using namespace std;
int main(){
	freopen("chess.in","r",stdin);
	freopen("chess.out","w",stdout);
	cout << 3 << endl<< 4 << endl<< 4 << endl<< 2 << endl<< 5 << endl<< 5 << endl<< 1 << endl;
	return 0;
}

也有代码人

C++
YN-001*

#include<iostream>
#include<cstdio>


using namespace std;



int main(){
	freopen("sequence.in","r",stdin);
	freopen("sequence.out","w",stdout);
	
	
	return 0;
}

高端随机人

代码
YN-003*

(1)

xpp
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;
int n;
int main()
{
	freopen("variance.in","r",stdin);
	freopen("variance.out","w",stdout);
	cin>>n;
	srand((unsigned int)time(NULL));
	long long r1=0;
	long long r2=0;
	if(n>15)
	{
		r1=rand()%32768;
	}
	if(n<6)
	{
		r2=rand()%1000;
	}
	else
	{
		r2=rand()%32768;
	}
	long long ans=r1*32768+r2;
	cout<<ans;
	fclose(stdin);
	fclose(stdout);
}

(2)

C++
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;
int T,n,m,p;
int main()
{
	freopen("chess.in","r",stdin);
	freopen("chess.out","w",stdout);
	cin>>T;
	while(T)
	{
		cin>>n>>m>>p;
		srand((unsigned int)time(NULL));
		for(int i=0;i<(2*n+1);i++)
		{
			int x;
			cin>>x;
		}
		for(int i=0;i<p;i++)
		{
			int x1,x2,x3,x4;
			cin>>x1>>x2>>x3>>x4;
			long long r1=0;
			long long r2=0;
			if(x4>60)
			{
				r1=rand()%32768;
			}
			if(x4<20)
			{
				r2=rand()%1000;
			}
			if(x4<4)
			{
				r2=rand()%15;
			}
			else
			{
				r2=rand()%32768;
			}
			long long ans=r1*32768+r2;
			cout<<ans<<endl;
		}
		T--;
	}
	
	fclose(stdin);
	fclose(stdout);
}

函数全无人

C++
YN-003*
(以下代码为"variance.cpp"全部内容)

#include<iostream>
#include<cstdio>
#include<stdlib.h>
#include<time.h>
#include<random>
using namespace std;

充码人

C++
YN-003*
(以下代码为"chess.cpp"全部内容)

#include<iostream>
#include<cstdio>
using namespace std;
int d=1,k=1;
int main(){
	freopen("1","w",stdout);
	for(long long i=0;i<=10;i++){
		d=i;
		k=d;
		while(k>=1){
	    if(k%10==7){
	    cout<<"d%"<<d<<"!="<<"0"<<"&&";break;}
	    k=k/10;
		}
}
	return 0;
}

占码人

C++
YN-004*
(以下代码为"chess.cpp"全部内容)

#include<bits/stdc++.h>
using namespace std;
#define N 
int main(){
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	
	return 0;
}

注释人

C++
YN-006*

//	freopen("sequence.in","r",stdin);
//	freopen("sequence.out","w",stdout);

骗寂寞人

代码
YN-007*
(以下三码分别归于同一者的 T2,T3,T4)

(1)

C++
#include<bits/stdc++.h>
using namespace std;
int A[10001];
int main()
{

	printf("%d",642171527);
}

(2)

C++
#include<bits/stdc++.h>
using namespace std;
int A[10001];
int main()
{
	int n,f=0,sum=0,average;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}
	for(int i=0;i<n;i++)
	{
		if(A[i]==A[i-1]+A[i+1]-A[i])
		{
			A[i]==A[i-1]+A[i+1]-A[i];
		}
		sum=sum+A[i];
	} 
	average=sum/n;
	for(int i=0;i<n;i++)
	{
		f=pow(2,A[i]-average);
	}
	printf("%d",f);
}

(3)

C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
	printf("%d",3);
	printf("%d",4);
	printf("%d",4);
	printf("%d",2);
	printf("%d",5);
	printf("%d",5);
	printf("%d",1);
	
}

骗寂寞人&高端随机人

C++
YN-007*

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
	srand(time(0));
	ll T;
	scanf("%lld", &T);
	while (T--){
		ll n, m, q;
		for (ll i = 0; i < n; i++){
			string s;
			cin >> s;
		}
		for (ll i = 1; i < n; i++){
			string s;
			cin >> s;
		}
		for (ll i = 0; i < q; i++){
			ll a, b, c, d;
			scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
			
			cout << rand() * rand() % 100 + 1;
		}
	}
	return 0;
}

看到了这里,相信部分代码使您一乐,亦或使您对他人之码有所鉴之。
同时,如有更多需求,可到此导航查看更多地区的代码大展。

文末,念在企鹅整理的辛苦,动动您的小手点个赞支持一下呗~

原文
存档评论9 条抓取于