With fast developments of information and communication technology, many cities today have established bicycle sharing systems. The key component of the system is to provide information on nearby bicycles to potential users.

Consider mmm bicycles and nnn customers, where each bicycle is located at coordinate (cj,dj)(c_j , d_j )(cj​,dj​) for j=1,2,...,m,j = 1, 2, ... , m,j=1,2,...,m, and each user iii is located at coordinate (ai,bi)(a_i, b_i)(ai​,bi​) for i=1,2,...,ni = 1, 2, ... , ni=1,2,...,n The distance between two coordinates (x,y)(x, y)(x,y) and (x,y)(x, y)(x,y) is measured by (x−x)2+(y−y)2 \sqrt{(x-x)^2 +(y-y)^2}(x−x)2+(y−y)2 ​. For each user i=1,2,...,ni = 1,2,...,ni=1,2,...,n, you are given a threshold sis_isi​, your task is to return the total number of bicycles that are within a distance of si from user iii.

Input

The test data may contain many test cases. Each test case contains four lines. The first line of each case contains two integers, mmm and n(0<m,n≤1000)n (0 < m, n \le 1000)n(0<m,n≤1000). The second line contains the coordinates, (c1,d1),(c2,d2),...,(cm,dm)(c_1, d_1), (c_2, d_2), ... , (c_m, d_m)(c1​,d1​),(c2​,d2​),...,(cm​,dm​), of bicycles 1,2,...,m 1, 2, ... , m1,2,...,m, respectively, which are separated by a space. The third line contains the coordinates,(a1,b1),(a2,b2),...,(an,bn)(a1, b1), (a2, b2), ... , (an, bn)(a1,b1),(a2,b2),...,(an,bn), of users 1,2,...,n1, 2,... , n1,2,...,n, respectively, which are separated by a space. contains the thresholds, s1,s2,...,sns_1, s_2, ... , s_ns1​,s2​,...,sn​, of the nnn users. The last test case is followed by a line of two 000s. All the number of coordinate in the input is in the range [−100000,100000][-100000, 100000][−100000,100000].

Output

The output for each test case contains a line of nnn integers, k1,k2,...,knk_1, k_2, ... , k_nk1​,k2​,...,kn​, where each ki represents the total number of bicycles that are within a distance of sis_i si​ from user iii, for i=1,2,...,ni = 1,2,...,ni=1,2,...,n.

样例输入

4 2
(0,0) (0,1) (1,0) (1,1)
(0,0) (1,1)
1 1
0 0

样例输出

3 3

C++期末考试题。。。
基本输入输出,傻了。
那个括号完全可以当作字符输入然后不管他的嘤嘤嘤。
强行用gets带偏队友
然后又强行用字符串带偏队友
每说一句话要深思熟虑,否则就成为坑货了。。。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct data
{
ll x=,y=;
ll dist=;
ll ans=;
};
ll fun(ll x1,ll x2,ll y1,ll y2)
{
return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
char s[]= {};
int main()
{
ios::sync_with_stdio(false);
int n,m;
char e,f,g;
while(cin>>n>>m&&n&&m){
int i;
data a[];
data b[];
for(i=; i<=n; i++) cin>>e>>a[i].x>>f>>a[i].y>>g;
for(i=; i<=m; i++) cin>>e>>b[i].x>>f>>b[i].y>>g;
for(i=; i<=m; i++)
{
ll si;
cin>>si;
b[i].dist=si*si;
}
int j;
for(i=; i<=m; i++)
{
for(j=; j<=n; j++)
{
ll dd=fun(a[j].x,b[i].x,a[j].y,b[i].y);
if(dd<=b[i].dist) b[i].ans++;
}
}
for(i=; i<m; i++) cout<<b[i].ans<<" ";
cout<<b[i].ans<<endl;
}
return ;
}

Nearby Bicycles的更多相关文章

  1. ACM-ICPC 2017 Asia HongKong 解题报告

    ACM-ICPC 2017 Asia HongKong 解题报告 任意门:https://nanti.jisuanke.com/?kw=ACM-ICPC%202017%20Asia%20HongKon ...

  2. 【洛谷3047】[USACO12FEB]附近的牛Nearby Cows

    题面 题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into acc ...

  3. 【bzoj2591】[Usaco 2012 Feb]Nearby Cows 树形dp

    题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into accoun ...

  4. 树形DP【洛谷P3047】 [USACO12FEB]附近的牛Nearby Cows

    P3047 [USACO12FEB]附近的牛Nearby Cows 农民约翰已经注意到他的奶牛经常在附近的田野之间移动.考虑到这一点,他想在每一块土地上种上足够的草,不仅是为了最初在这片土地上的奶牛, ...

  5. [USACO12FEB]附近的牛Nearby Cows

    题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into accoun ...

  6. 洛谷P3047 [USACO12FEB]Nearby Cows(树形dp)

    P3047 [USACO12FEB]附近的牛Nearby Cows 题目描述 Farmer John has noticed that his cows often move between near ...

  7. 洛谷 P3047 [USACO12FEB]附近的牛Nearby Cows

    P3047 [USACO12FEB]附近的牛Nearby Cows 题目描述 Farmer John has noticed that his cows often move between near ...

  8. 如何用HMS Nearby Service给自己的APP开发一个名片交换功能?

      在工作和生活中,遇见新的同事或者合作伙伴,交换名片是一个常见的用户需求,纸质名片常忘带.易丢失,是客户的一个痛点.因此,市场上出现了很多交换电子名片的APP和小程序.那么,如何给自己的APP开发一 ...

  9. 如何用Nearby Service开发针对附近人群的精准广告推送功能

      当你想找一家餐厅吃饭,却不知道去哪家,这时候手机跳出一条通知,为你自动推送附近优质餐厅的信息,你会点击查看吗?当你还在店内纠结于是否买下一双球鞋时,手机应用给了你发放了老顾客5折优惠券,这样的广告 ...

随机推荐

  1. 监控系统负载与CPU、内存、硬盘、登录用户数,超出警戒值则发邮件告警。

    zzx@zzx:~$ cat warning.sh #!/bin/bash #监控系统负载与CPU.内存.硬盘.登录用户数,超出警戒值则发邮件告警.    前提安装mail服务nh=`uname -r ...

  2. linux 替换jdk指定jar包

    我的bug是:jdk1.8的安全策略和腾讯邮箱服务有冲突.我知道的解决方法: 1更换低版本安全策略相关的jar包.(windows:http://www.cnblogs.com/dennyzhangd ...

  3. MySQL视图和事务

    视图的操作                                                                                                ...

  4. 寒假day08

    今天爬了部分与人才动态相关的数据,还刷了剑指offer的部分算法题

  5. css 设置奇数行偶数行样式

    .list ul li:nth-child(even){ ...}    //li的偶数行样式 .list ul li:nth-child(odd){ ...}    //li的奇数行样式 .list ...

  6. idea创建远程分支

    1.先从远程拉取一个完整的分支,master或dev 2.新建一个分支,new,新建的同时checkout 出来 3.把新建的分支push到远程 4.如果新建完分支后写代码了,需要先把代码提交然后一起 ...

  7. 【leetcode困难】968. 监控二叉树

    968. 监控二叉树 瞎**分析评论区Rui大佬的答案,这题想直接递归return min还是有坑的,分计数和状态.有个状态转换的思想

  8. python获取页面文字信息

    # -*- coding: utf- -*- from selenium import webdriver import time, re,requests,os,time,random,traceb ...

  9. UML的用例图

    1.概念理解 (1)用例图是UML多种图形语言的一种,最能体现系统结构,直观展现系统功能模块模型 (2)用例图用于描述用户与用例(角色与功能模块)之间的关联关系 (3)常用Power Designer ...

  10. 2. Rabbitmq php 安装 amqp 拓展

    记录一下 使用 rabbitmq 安装 amqp 拓展 环境 ubuntu   安装目录在 /user/local 下进行 1. 安装 wget apt-get update apt-get inst ...