跳到正文

个人记录

1.27考试复盘

Daniel_Chou_hn约 6 分钟
原文

这是 2026年1月27日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

收录
2026年1月27日
更新
2026年1月28日
篇幅
约 6 分钟

版本

  1. v2当前
  2. v1

APOZ最开心的一次

1.座位

题目思路:

题目图片

👆注意看上面的S形轨迹,那是最难di
可以想到暴力模拟,但老师说是数学
暴力也是可以拿满分的
再用上美味的方向数组 模拟S型移动

暴力代码
C++
#include<bits/stdc++.h>
using namespace std;
int g[110];
bool cmp(int a,int b){
	return a>b;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	int n,m;
	cin>>n>>m;
	cin>>g[1];
	int r=g[1];
	for(int i=2;i<=n*m;i++){
		cin>>g[i];
	}
	sort(g+1,g+n*m+1,cmp);
	int posr;
	for(int i=1;i<=n*m;i++){
		if(g[i]==r){
			posr=i;
			break;
		}
	}
//	cout<<posr;
	int x=1,y=1;
	for(int i=1;i<=n*m;i++){
		if(i>=posr){
			cout<<x<<' '<<y;
			exit(0);
		}
		if(x%2==1 and y==n){
			x++;
			continue;
		}
		else if(x%2==0 and y==1){
			x++;
			continue;
		}
		if(x%2==1)y++;
		else y--;
	}
//	cout<<posr/n<<' '<<(((posr/2)%2)==0)?n-posr%n:posr%n;.
	/*
	97 100 99 98
	^
	1    2
1	100  97
2	99   98
	
	
	3---(2,1)
	2---(1,2)
	1---(1,1)
	
	*/
	return 0;
}

至于数学代码

数学代码

2.密码锁

错因分析

我:(写代码中……)
未知:你知道吗?今天考搜索(幸灾乐祸)
我:(惊讶)真的?

于是我写了一个DFS,所以我只得了30分

老师:这道题你就算输出81都能得30分……
我:([表情不存在])

题目思路

跟 不知道是哪场考试 一样都是枚举答案的思路
把所有可能的答案都算出来,再通过一个函数进行统一计算(其实是两个)
至于如何判断那就可以请出伟大的

cnt博士

枚举cnt从而判断两个数组是否相同

AC代码
C++
#include<bits/stdc++.h>
using namespace std;
bool f(int b[],int a[]){
	int cnt=0;
	int x=-1,y=-1;
	for(int i=1;i<=5;i++){
		if(a[i]!=b[i]){
			cnt++;
			if(x==-1)x=i;
			else y=i;
		}
	}
	if(cnt==0)return 0;
	if(cnt==1)return 1;
	if(cnt>2 or y-x>1)return 0;
	
	int n1=a[x],n2=a[y];
	
	for(int i=1;i<=9;i++){
		n1 = (n1 + 1) % 10;
		n2 = (n2 + 1) % 10;
		if (n1 == b[x] and n2 == b[y]) return 1;
	}
	return 0;
}

int b[10][10];
int a[10];
int n;

bool check(){
	int s=0;
	for(int i=1;i<=n;i++){
		if(f(b[i],a)){
			s++;
		}
	}
	return s==n;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=5;j++){
			cin>>b[i][j];
		}
	}
	int res=0;
	for(a[1]=0;a[1]<=9;a[1]++){
	
		for(a[2]=0;a[2]<=9;a[2]++){
		
			for(a[3]=0;a[3]<=9;a[3]++){
			
				for(a[4]=0;a[4]<=9;a[4]++){
				
					for(a[5]=0;a[5]<=9;a[5]++){
						if(check()){
							res++;
						}
					}	
				}	
			}	
		}	
	}
	cout<<res;
	return 0;
}

3.寻宝

当时没时间了于是直接

吃我一暴力

然后就提交了

题目思路

看起来和我的代码基本一样,只是多了一个数组

AC代码
C++
#include<bits/stdc++.h>
using namespace std;
struct P{
	int lt,x;
};
int n,m;
int q[10005];
P a[10005][105];
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j].lt>>a[i][j].x;
			if(a[i][j].lt==1)q[i]++;
		}
	}
	int x=0,y,res=0;
	cin>>y;
	
	while(x<n){
		int k=a[x][y].x;
		res=(res+k)%20123;
		k%=q[x];
		if(k==0)k=q[x];
		while(1){
			if(a[x][y].lt==1)k--;
			if(k==0)break;
			y=(y+1)%m;
		}
		x++;
		
	}
	cout<<res;
	return 0;
}

我写完?
NONO
凑3130字