跳到正文

个人记录

50粉福提问板

cool_xu约 4 分钟
原文
文章信息与版本

文章信息

发布
2023年8月27日
收录
2025年12月12日
更新
2026年11月12日
篇幅
约 4 分钟

版本

  1. v1当前

5个QQ&AA 一人限一次

1 by @Obscene 和 @Livy_lyh

有npy吗?

cool_xu:肯定……没有,学霸不在乎爱情。我绝对不会说是因为找不到

.\color{white} .

2 by @Forever_LYD

你当小黑子几年了?

cool_xu:谁™跟你说的我是小黑子了?我可是真爱粉!

.\color{white} .

3 by @Zan_mao

喜欢van什么游戏?

cool_xu:和平、蛋仔、MC(主玩)、生死狙击2(主玩)、元气、CF、漫威超级战争

.\color{white} .

4 by @work_out_study

身份证号?

cool_xu:a?114514191981054188 qwq

5 by ???

马蜂:

看我的独特马蜂

C++
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;struct data{long long row,column;}a[100];long long n,m,k,ans;bool cmp(data x,data y){if(x.row!=y.row){return x.row<y.row;}else{return x.column<y.column;}}int main(){memset(a,-1,sizeof(a));scanf("%lld%lld%lld",&n,&m,&k);for(int i=1;i<=k;i++){long long x,y;scanf("%lld%lld",&x,&y);a[i]={x,y};}sort(a+1,a+1+k,cmp);ans=n;ans*=m-1;for(int i=1;i<=k;i++){if(a[i-1].row==a[i].row){if(a[i].column!=1&&a[i-1].column==a[i].column-1){ans-=1;}else{ans-=2;}if(a[i].column==m){ans++;}}else{if(a[i].column==1||a[i].column==m){ans-=1;}else{ans-=2;}}}printf("%lld",ans);return 0;}

其实这个才是

C++
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
struct data{
	long long row, column;
}a[100];
long long n,m,k,ans;
bool cmp(data x,data y){
	if(x.row!=y.row){
		return x.row<y.row;
	}else{
		return x.column<y.column;
	}
}int main(){
	//freopen("testin.in","r",stdin);
	//freopen("testout.out","w",stdout);
	memset(a,-1,sizeof(a));
	scanf("%lld%lld%lld",&n,&m,&k);
	for(int i=1;i<=k;i++){
		long long x,y;
		scanf("%lld%lld",&x,&y);
		a[i]={x,y};
	}sort(a+1,a+1+k,cmp);
	ans=n;
	ans*=m-1;
	for(int i=1;i<=k;i++){
		if(a[i-1].row==a[i].row){
			if(a[i].column!=1 && a[i-1].column==a[i].column-1){
				ans-=1;
			}else{
				ans-=2;
			}
			if(a[i].column==m){
				ans++;
			}
		}else{
			if( a[i].column==1 || a[i].column==m ){
				ans-=1;
			}else{
				ans-=2;
			}
		}
	}printf("%lld",ans);
	return 0;
}
原文
存档评论8 条抓取于