当前位置:网站首页>CCF201912-2 回收站选址
CCF201912-2 回收站选址
2022-07-28 11:49:00 【.DoubleBean.】



样例1输入
7
1 2
2 1
0 0
1 1
1 0
2 0
0 1
样例1输出
0
0
1
0
0
样例2输入
2
0 0
-100000 10
样例2输出
0
0
0
0
0
样例3输入
11
9 10
10 10
11 10
12 10
13 10
11 9
11 8
12 9
10 9
10 11
12 11
样例3输出
0
2
1
0
0
代码:
#include<stdio.h>
#include<math.h>
const long long int maxn = 1e9 + 5;
//每个点用一个结构体来定义,包含他的x,y坐标
struct node{
long long int x, y;
}DATA[1005];
int main(){
int n, j, i, len = 0, res[5] = {
0};
scanf("%d",&n);
long long int xx, yy;
while(n--){
scanf("%lld%lld", &xx, &yy);
DATA[len].x = xx;
DATA[len].y = yy;
len++;
}
for(i=0;i<len;i++){
int count = 0;
for(j=0;j<len;j++){
//判断两结点是否相邻
if(abs(DATA[j].x-DATA[i].x)==1 && DATA[j].y==DATA[i].y || abs(DATA[j].y-DATA[i].y)==1 && DATA[j].x==DATA[i].x){
count++;
}
}
if(count==4){
//表示存在可选地址的结点
int key = 0;
for(j=0;j<len;j++){
if(abs(DATA[j].x-DATA[i].x)==1 && abs(DATA[j].y-DATA[i].y)==1) key++;
}
res[key]++;
}
}
for(i=0;i<5;i++){
printf("%d\n", res[i]);
}
return 0;
}
边栏推荐
- 非标自动化设备企业如何借助ERP系统,做好产品质量管理?
- Deployment之滚动更新策略。
- 【Base】优化性能到底在优化啥?
- New Oriental's single quarter revenue was 524million US dollars, a year-on-year decrease of 56.8%, and 925 learning centers were reduced
- OpenAtom OpenHarmony分论坛圆满举办,生态与产业发展迈向新征程
- AI制药的数据之困,分子建模能解吗?
- 【一知半解】零值拷贝
- 利用依赖包直接实现分页、SQL语句
- FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be depreca
- Most of the interfaces of Tiktok are already available, and more interfaces are still open. Please look forward to it
猜你喜欢

Sub database and sub table may not be suitable for your system. Let's talk about how to choose sub database and sub table and newsql

What SaaS architecture design does a software architect need to know?

With the continuous waves of infringement, the U.S. patent and trademark office began to study the impact of NFT on copyright

Marketing play is changeable, and understanding the rules is the key!

Brief discussion on open source OS distribution

MarkDown简明语法手册

Uncover why devaxpress WinForms, an interface control, discards the popular maskbox property

Developing NES games with C language (cc65) 09, scrolling

AVL树(平衡搜索树)

sqli-labs(less-8)
随机推荐
20220728-Object类常用方法
1331. 数组序号转换 : 简单模拟题
公司在什么情况下可以开除员工
Uninstall Navicat: genuine MySQL official client, really fragrant!
GMT installation and use
STM32 loopback structure receives and processes serial port data
Uniapp 应用开机自启插件 Ba-Autoboot
leetcode:数组
Hongjiu fruit passed the hearing: five month operating profit of 900million Ali and China agricultural reclamation are shareholders
AI制药的数据之困,分子建模能解吗?
Four authentic postures after suffering and trauma, Zizek
Insufficient permission to pull server code through Jenkins and other precautions
Unity 安装 Device Simulator
MySQL总是安装不成功,这样处理就好啦
With the continuous waves of infringement, the U.S. patent and trademark office began to study the impact of NFT on copyright
Kuzaobao: summary of Web3 encryption industry news on July 13
The input string contains an array of numbers and non characters, such as a123x456. Take the consecutive numbers as an integer, store them in an array in turn, such as 123 in a[0], 456 in a[1], and ou
The 'name' attribute value associated with the element type 'item' cannot contain '& lt;' Character solution
Holes in [apue] files
MMA8452Q几种模式的初始化实例