当前位置:网站首页>(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;
}
边栏推荐
- TS 类型体操 之 循环中的键值判断,as 关键字使用
- 【mysql学习笔记29】触发器
- Simulation of Michelson interferometer based on MATLAB
- 【MySQL学习笔记32】mvcc
- Ble of Jerry [chapter]
- Le chemin du navigateur Edge obtient
- Go learning -- implementing generics based on reflection and empty interfaces
- Luogu p1836 number page solution
- Methods for JS object to obtain attributes (. And [] methods)
- datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在
猜你喜欢
Go learning -- implementing generics based on reflection and empty interfaces
Set picture annotation in markdown
Bugku CTF daily question: do you want seeds? Blackmailed
JMeter performance test steps practical tutorial
TS 类型体操 之 循环中的键值判断,as 关键字使用
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
qt颜色与字符串、uint相互转换
QT color is converted to string and uint
智能终端设备加密防护的意义和措施
杰理之BLE【篇】
随机推荐
Ble of Jerry [chapter]
[MySQL learning notes 32] mvcc
TypeScript 变量作用域
jmeter性能测试步骤实战教程
In the era of digital economy, how to ensure security?
2022年Instagram运营小技巧简单讲解
Openjudge noi 2.1 1749: Digital Square
Typescript interface and the use of generics
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控制器参数自整定
位运算异或
Set picture annotation in markdown
TypeScript void 基础类型
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
Generator Foundation
Oracle column to row -- a field is converted to multiple rows according to the specified separator
超级浏览器是指纹浏览器吗?怎样选择一款好的超级浏览器?
Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
Jerry needs to modify the profile definition of GATT [chapter]
杰理之需要修改 gatt 的 profile 定义【篇】