跳到正文

个人记录

CSP-J2024一等奖卡分数线代码

wangzixu2011约 5 分钟
原文
文章信息与版本

文章信息

发布
2025年1月27日
收录
2025年12月12日
更新
2026年9月23日
篇幅
约 5 分钟

版本

  1. v1当前

前言

由于本人CSP-J2024比赛时脑抽挂了160pts,而今天仅花1小时写出了刚过一等线的代码,特写此文发泄一下。

正文

csp-j2024一等分数线为235pts,晒出以下的240pts代码:

T1

这道题没什么好说的,直接上代码:

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 52+5;
int n,cnt = 0;
string s[N];
bool vis[N];
signed main(){
	cin>>n;
	for(int i = 1;i <= n;i++) cin>>s[i];
	for(int i = 1;i <= n;i++){
		if(!vis[i]){
			for(int j = i+1;j <= n;j++){
				if(s[i] == s[j]) vis[j] = 1;
			}
			cnt++;
		} 
	}
	cout<<52-cnt;
	return 0;
} 

T2

这道题忘开vis数组还过了大样例,导致我才60pts

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e3+5;
int t;
int n,m,k;
int x,y,d;
char c[N][N];
bool vis[N][N];
int x_1,y_1,ans;
signed main(){
	cin>>t;
	for(int i = 1;i <= t;i++){
		cin>>n>>m>>k;
		cin>>x>>y>>d;
		for(int i = 1;i <= n;i++)
			for(int j = 1;j <= m;j++)
				cin>>c[i][j];
		for(int i = 1;i <= n;i++)
			for(int j = 1;j <= m;j++)
				vis[i][j] = 0;
		vis[x][y] = 1,ans = 1;
		for(int i = 1;i <= k;i++){
			if(d == 0) x_1 = x,y_1 = y+1;
			else if(d == 1) x_1 = x+1,y_1 = y;
			else if(d == 2) x_1 = x,y_1 = y-1;
			else if(d == 3) x_1 = x-1,y_1 = y;
			if(x_1 >= 1 && x_1 <= n && y_1 >= 1 && y_1 <= m && c[x_1][y_1] == '.'){
				x = x_1,y = y_1;
				if(!vis[x][y]){
					vis[x][y] = 1;
					ans++;
				}
			} 
			else d = (d+1) % 4;
		}
		cout<<ans<<'\n';
	}
	return 0;
}

T3

这道题我当时居然一分没骗到,无语。 以下是打表骗分的40pts代码:

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,n;
signed main(){
	cin>>t;
	for(int i = 1;i <= t;i++){
		cin>>n;
		if(n % 7 == 0){
			for(int j = 1;j <= n/7;j++)
				cout<<8;
			cout<<'\n';
		}
		else if(n == 1) cout<<-1<<'\n';
		else if(n == 2) cout<<1<<'\n';
		else if(n == 3) cout<<7<<'\n';
		else if(n == 4) cout<<4<<'\n';
		else if(n == 5) cout<<2<<'\n';
		else if(n == 6) cout<<6<<'\n';
		else if(n == 8) cout<<10<<'\n';
		else if(n == 9) cout<<18<<'\n';
		else if(n == 10) cout<<22<<'\n';
		else if(n == 11) cout<<20<<'\n';
		else if(n == 12) cout<<28<<'\n';
		else if(n == 13) cout<<68<<'\n';
		else if(n == 15) cout<<108<<'\n';
		else if(n == 16) cout<<188<<'\n';
		else if(n == 17) cout<<200<<'\n';
		else if(n == 18) cout<<208<<'\n';
		else if(n == 19) cout<<288<<'\n';
		else if(n == 20) cout<<688<<'\n';
	}
	return 0;
}

T4

作为一个OIer最后的尊严还是要有的:

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    return 0;
}

结语

2024年的CSP-J可以说是最水的一次了,这次不拿一等,以后怕是没机会了,但愿我今年CSP-S不会再像去年那样脑抽,犯如此低级的错误

原文