当前位置:网站首页>(lightoj - 1410) consistent verbs (thinking)
(lightoj - 1410) consistent verbs (thinking)
2022-07-06 07:38:00 【AC__ dream】
Topic link :Consistent Verdicts | LightOJ
The question : There are... On a plane n personal , give n Personal position , Everyone has a grab , And everyone will shoot a bullet , this n Individuals can hear gunshots at the same distance , Give at random n A number represents the gunshot that everyone can hear except himself , this n A number may or may not be legal , Now ask the total number of legal schemes ?
This question is actually a thinking question , Direct thinking is not easy to solve problems , We just want to , If the distance everyone hears is limited , Then the answer is fixed , But there may be multiple distances corresponding to the same situation , For example, when the distance between everyone is greater than 1000 when , So if everyone hears the distance is 0~1000, Then everyone hears the gunshot 0, Therefore, it is not difficult for us to think , When the distance between all people increases in order ( After removing the repeated distance ) Arranged as a[1],a[2],……, Then the distance to hear the sound is 0~a[1]-1,a[1]~a[2]-1,…… Each corresponds to a legal scheme , in other words The number of different distances between people plus 1 Is the answer , This can be well understood , The idea is still quite wonderful
Here is the code :
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
using namespace std;
#define int long long
const int N=703;
vector<int>alls;
int x[N],y[N];
signed main()
{
int T;
cin>>T;
for(int _=1;_<=T;_++)
{
int n;
scanf("%lld",&n);
for(int i=1;i<=n;i++)
scanf("%lld%lld",&x[i],&y[i]);
alls.clear();
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
alls.push_back((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
sort(alls.begin(),alls.end());
alls.erase(unique(alls.begin(),alls.end()),alls.end());
printf("Case %lld: %lld\n",_,alls.size()+1);
}
return 0;
}
边栏推荐
- Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
- When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
- 学go之路(二)基本类型及变量、常量
- Google may return to the Chinese market after the Spring Festival.
- Emo diary 1
- 智能终端设备加密防护的意义和措施
- Luogu p4127 [ahoi2009] similar distribution problem solution
- 上线APS系统,破除物料采购计划与生产实际脱钩的难题
- 洛谷P1836 数页码 题解
- Typescript void base type
猜你喜欢
Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
Fundamentals of C language 9: Functions
opencv学习笔记九--背景建模+光流估计
TypeScript接口与泛型的使用
Relevant introduction of clip image
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
TS 类型体操 之 循环中的键值判断,as 关键字使用
Bugku CTF daily question: do you want seeds? Blackmailed
The way to learn go (I) the basic introduction of go to the first HelloWorld
word中如何删除某符号前面或后面所有的文字
随机推荐
Ble of Jerry [chapter]
Simulation of Michelson interferometer based on MATLAB
剪映的相关介绍
杰理之BLE【篇】
Related operations of Excel
navicat如何导入MySQL脚本
word中把帶有某個符號的行全部選中,更改為標題
Jerry needs to modify the profile definition of GATT [chapter]
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
MEX有关的学习
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
opencv学习笔记八--答题卡识别
智能终端设备加密防护的意义和措施
Scala language learning-08-abstract classes
Scala语言学习-08-抽象类
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Simple and understandable high-precision addition in C language
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】