当前位置:网站首页>(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;
}
边栏推荐
- 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
- 继电反馈PID控制器参数自整定
- PHP Coding Standard
- C # connect to SQLite database to read content
- TS 体操 &(交叉运算) 和 接口的继承的区别
- Bugku CTF daily question: do you want seeds? Blackmailed
- Word delete the contents in brackets
- OpenJudge NOI 2.1 1661:Bomb Game
- Select all the lines with a symbol in word and change them to titles
- 杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
猜你喜欢
How MySQL merges data
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
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学习笔记九--背景建模+光流估计
杰理之BLE【篇】
Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
MEX有关的学习
智能终端设备加密防护的意义和措施
[cf gym101196-i] waif until dark network maximum flow
随机推荐
Ble of Jerry [chapter]
JMeter performance test steps practical tutorial
Bloom taxonomy
[MySQL learning notes 30] lock (non tutorial)
How to delete all the words before or after a symbol in word
Opencv learning notes 9 -- background modeling + optical flow estimation
The way to learn go (I) the basic introduction of go to the first HelloWorld
Brief explanation of instagram operation tips in 2022
GET/POST/PUT/PATCH/DELETE含义
word中把带有某个符号的行全部选中,更改为标题
[computer skills]
数字经济时代,如何保障安全?
Force buckle day31
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
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
TypeScript 接口属性
Related operations of Excel
word中如何删除某符号前面或后面所有的文字
TS 体操 &(交叉运算) 和 接口的继承的区别
Simulation of Teman green interferometer based on MATLAB