@[【http://noi.openjudge.cn/】4.3算法之图论——1538:Gopher II]
题目
查看提交统计提问
总时间限制: 2000ms 内存限制: 65536kB
描述
The gopher family, having averted the canine threat, must face a new predator.
The are n gophers and m gopher holes, each at distinct (x, y) coordinates. A hawk arrives and if a gopher does not reach a hole in s seconds it is vulnerable to being eaten. A hole can save at most one gopher. All the gophers run at the same velocity v. The gopher family needs an escape strategy that minimizes the number of vulnerable gophers.
输入
The input contains several cases. The first line of each case contains four positive integers less than 100: n, m, s, and v. The next n lines give the coordinates of the gophers; the following m lines give the coordinates of the gopher holes. All distances are in metres; all times are in seconds; all velocities are in metres per second.
输出
Output consists of a single line for each case, giving the number of vulnerable gophers.
样例输入
2 2 5 10
1.0 1.0
2.0 2.0
100.0 100.0
20.0 20.0
样例输出
1
翻译
**题目:**地鼠II
描述:
地鼠家族在避免了犬科动物的威胁后,必须面对一个新的捕食者。
有n个地鼠洞和m个地鼠洞,每个洞都位于不同的(x,y)坐标处。一只鹰来了,如果地鼠在s秒内没有到达一个洞,它很容易被吃掉。一个洞最多只能救一只地鼠。所有的地鼠都以相同的速度奔跑。地鼠家族需要一种逃生策略,以尽量减少易受攻击的地鼠数量。
输入:
输入包含几个案例。每种情况的第一行包含四个小于100的正整数:n、m、s和v。接下来的n行给出地鼠的坐标;以下m线给出了地鼠洞的坐标。所有距离均以米为单位;所有时间均以秒为单位;所有速度均以米每秒为单位。
输出:
输出由每种情况的单行组成,给出了易受攻击的地鼠数量。
例如:
在语言模型中,编码器和解码器都是由一个个的 Transformer 组件拼接在一起形成的。
代码
#include <bits/stdc++.h>
using namespace std;
struct point {
double x, y;
int id,oid;
vector<point*> h;
point() {
x = 0; y = 0;oid=0;}//成员要初始化,否则会"runtime error"
point(int idx, double px, double py) : id(idx), oid(0), x(px), y(py) {
}
}one[210];
bool k[210];
int n, m, s, v,ans;
double x, y;
void view(int x,point* p){
cout<<x<<endl;
cout<<"坐标"<<p->x<<","<<p->y<<endl;
cout<<"可达目标:\n";
for(vector<point*>::iterator i=p->h.begin();i!=p->h.end();i++)
cout<<"("<<(*i)->x<<","<<(*i)->y<<")\t";
cout<<"选中"<<p->oid<<endl;
}
void view(){
for(int i=n+1;i<=n+m;i++){
cout<<i<<"坐标"<<one[i].x<<","<<one[i].y<<"\t"<<"达"<<one[i].oid<<endl;
}
cout<<endl;
}
bool go(point *p){

最低0.47元/天 解锁文章
806

被折叠的 条评论
为什么被折叠?



