关于CSP_S第一题
  • 板块学术版
  • 楼主hkt486
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/10/23 21:38
  • 上次更新2023/11/2 11:39:17
查看原帖
关于CSP_S第一题
1039740
hkt486楼主2023/10/23 21:38

有大佬知道这段代码怎么得的70分吗(我自己写的时候稀里糊涂的)

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[9][7],ans=0,wei;
signed main() {
//	freopen("lock.in","r",stdin);
//	freopen("lock.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	if(n==1) {
		cout<<81;
		return 0;
	}
	if(n==2) {
		for(int i=1; i<=n; i++)
			for(int j=1; j<=5; j++)
				cin>>a[i][j];
		for(int i=1; i<=5; i++) {
			if(a[1][i]!=a[2][i]) {
				wei=i;
				ans++;
			}
		}
		if(ans==1 and wei==1 or wei==5)
			cout<<12-n;
		else cout<<14-n;
	} 
	else cout<<10-n;
	return 0;
}

违规自删

2023/10/23 21:38
加载中...