当前位置:网站首页>(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;
}边栏推荐
- C intercept string
- js對象獲取屬性的方法(.和[]方式)
- Word delete the contents in brackets
- 【mysql学习笔记29】触发器
- QT color is converted to string and uint
- TS 类型体操 之 循环中的键值判断,as 关键字使用
- 杰理之普通透传测试---做数传搭配 APP 通信【篇】
- Luogu p1836 number page solution
- If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]
- Go learning --- use reflection to judge whether the value is valid
猜你喜欢
![Ble of Jerry [chapter]](/img/00/27486ad68bf491997d10e387c32dd4.png)
Ble of Jerry [chapter]
![When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]](/img/3e/3d5bff87995b4a9fac093a6d9f9473.png)
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]

Games101 Lesson 7 shading 1 Notes
![[CF Gym101196-I] Waif Until Dark 网络最大流](/img/66/6b339fc23146b5fbdcd2a1fa0a2349.png)
[CF Gym101196-I] Waif Until Dark 网络最大流

Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer

Oracle column to row -- a field is converted to multiple rows according to the specified separator
![Ble of Jerry [chapter]](/img/d8/d080ccaa4ee530ed21d62755808724.png)
Ble of Jerry [chapter]

Google may return to the Chinese market after the Spring Festival.

Related operations of Excel
![If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]](/img/d6/92ad1c6f84415de6ab0dfd16cd6073.png)
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
随机推荐
Get/post/put/patch/delete meaning
Significance and measures of encryption protection for intelligent terminal equipment
[cf gym101196-i] waif until dark network maximum flow
Ble of Jerry [chapter]
edge浏览器 路径获得
Typescript function definition
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
Excel的相关操作
Bit operation XOR
Bugku CTF daily question: do you want seeds? Blackmailed
Word delete the contents in brackets
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
Word setting directory
How can word delete English only and keep Chinese or delete Chinese and keep English
CF1036C Classy Numbers 题解
[MySQL learning notes 30] lock (non tutorial)
How MySQL merges data
Iterator Foundation
OpenJudge NOI 2.1 1661:Bomb Game