<p>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.</p> <p>Consider <span class="katex"><span class="katex-mathml">mm<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">m bicycles and <span class="katex"><span class="katex-mathml">nn<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">n customers, where each bicycle is located at coordinate <span class="katex"><span class="katex-mathml">(cj,dj)(c_j , d_j )<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord"><span class="mord mathit">c<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">j<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">d<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">j<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mclose">) for <span class="katex"><span class="katex-mathml">j=1,2,...,m,j = 1, 2, ... , m,<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">j<span class="mrel">=<span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">m<span class="mpunct">, and each user <span class="katex"><span class="katex-mathml">ii<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i is located at coordinate <span class="katex"><span class="katex-mathml">(ai,bi)(a_i, b_i)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord"><span class="mord mathit">a<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">i<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">b<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">i<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mclose">) for <span class="katex"><span class="katex-mathml">i=1,2,...,ni = 1, 2, ... , n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i<span class="mrel">=<span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">n The distance between two coordinates <span class="katex"><span class="katex-mathml">(x,y)(x, y)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord mathit">x<span class="mpunct">,<span class="mord mathit">y<span class="mclose">) and <span class="katex"><span class="katex-mathml">(x,y)(x, y)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord mathit">x<span class="mpunct">,<span class="mord mathit">y<span class="mclose">) is measured by <span class="katex"><span class="katex-mathml">(x−x)2+(y−y)2 \sqrt{(x-x)^2 +(y-y)^2}<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist svg-align"><span class="pstrut"><span class="mord"><span class="mopen">(<span class="mord mathit">x<span class="mbin">−<span class="mord mathit">x<span class="mclose"><span class="mclose">)<span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="mbin">+<span class="mopen">(<span class="mord mathit">y<span class="mbin">−<span class="mord mathit">y<span class="mclose"><span class="mclose">)<span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="pstrut"> <span class="vlist-s">​<span class="vlist-r"><span class="vlist">. For each user <span class="katex"><span class="katex-mathml">i=1,2,...,ni = 1,2,...,n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i<span class="mrel">=<span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">n, you are given a threshold <span class="katex"><span class="katex-mathml">sis_i<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord"><span class="mord mathit">s<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">i<span class="vlist-s">​<span class="vlist-r"><span class="vlist">, your task is to return the total number of bicycles that are within a distance of si from user <span class="katex"><span class="katex-mathml">ii<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p> <h3>Input</h3> <p>The test data may contain many test cases. Each test case contains four lines. The first line of each case contains two integers, <span class="katex"><span class="katex-mathml">mm<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">m and <span class="katex"><span class="katex-mathml">n(0&lt;m,n≤1000)n (0 &lt; m, n \le 1000)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">n<span class="mopen">(<span class="mord mathrm">0<span class="mrel">&lt;<span class="mord mathit">m<span class="mpunct">,<span class="mord mathit">n<span class="mrel">≤<span class="mord mathrm">1<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mclose">). The second line contains the coordinates, <span class="katex"><span class="katex-mathml">(c1,d1),(c2,d2),...,(cm,dm)(c_1, d_1), (c_2, d_2), ... , (c_m, d_m)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord"><span class="mord mathit">c<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">1<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">d<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">1<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mclose">)<span class="mpunct">,<span class="mopen">(<span class="mord"><span class="mord mathit">c<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">d<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mclose">)<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mopen">(<span class="mord"><span class="mord mathit">c<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">m<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">d<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">m<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mclose">), of bicycles <span class="katex"><span class="katex-mathml">1,2,...,m 1, 2, ... , m<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">m, respectively, which are separated by a space. The third line contains the coordinates,<span class="katex"><span class="katex-mathml">(a1,b1),(a2,b2),...,(an,bn)(a1, b1), (a2, b2), ... , (an, bn)<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">(<span class="mord mathit">a<span class="mord mathrm">1<span class="mpunct">,<span class="mord mathit">b<span class="mord mathrm">1<span class="mclose">)<span class="mpunct">,<span class="mopen">(<span class="mord mathit">a<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathit">b<span class="mord mathrm">2<span class="mclose">)<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mopen">(<span class="mord mathit">a<span class="mord mathit">n<span class="mpunct">,<span class="mord mathit">b<span class="mord mathit">n<span class="mclose">), of users <span class="katex"><span class="katex-mathml">1,2,...,n1, 2,... , n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">n, respectively, which are separated by a space. contains the thresholds, <span class="katex"><span class="katex-mathml">s1,s2,...,sns_1, s_2, ... , s_n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord"><span class="mord mathit">s<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">1<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">s<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord"><span class="mord mathit">s<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">n<span class="vlist-s">​<span class="vlist-r"><span class="vlist">, of the <span class="katex"><span class="katex-mathml">nn<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">n users. The last test case is followed by a line of two <span class="katex"><span class="katex-mathml">00<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathrm">0s. All the number of coordinate in the input is in the range <span class="katex"><span class="katex-mathml">[−100000,100000][-100000, 100000]<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mopen">[<span class="mord">−<span class="mord mathrm">1<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mpunct">,<span class="mord mathrm">1<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mord mathrm">0<span class="mclose">].</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p> <h3>Output</h3> <p>The output for each test case contains a line of <span class="katex"><span class="katex-mathml">nn<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">n integers, <span class="katex"><span class="katex-mathml">k1,k2,...,knk_1, k_2, ... , k_n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord"><span class="mord mathit">k<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">1<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord"><span class="mord mathit">k<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathrm mtight">2<span class="vlist-s">​<span class="vlist-r"><span class="vlist"><span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord"><span class="mord mathit">k<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">n<span class="vlist-s">​<span class="vlist-r"><span class="vlist">, where each ki represents the total number of bicycles that are within a distance of <span class="katex"><span class="katex-mathml">sis_i <span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord"><span class="mord mathit">s<span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist"><span class="pstrut"><span class="sizing reset-size6 size3 mtight"><span class="mord mathit mtight">i<span class="vlist-s">​<span class="vlist-r"><span class="vlist"> from user <span class="katex"><span class="katex-mathml">ii<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i, for <span class="katex"><span class="katex-mathml">i=1,2,...,ni = 1,2,...,n<span class="katex-html"><span class="strut"><span class="strut bottom"><span class="base"><span class="mord mathit">i<span class="mrel">=<span class="mord mathrm">1<span class="mpunct">,<span class="mord mathrm">2<span class="mpunct">,<span class="mord mathrm">.<span class="mord mathrm">.<span class="mord mathrm">.<span class="mpunct">,<span class="mord mathit">n.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p> <div id="samples"> <div class="jsk-margin-vertical-sm"> <h4 class="title">样例输入</h4> <pre class="jsk-text-danger jsk-text-default jsk-padding-vertical-xs">4 2 (0,0) (0,1) (1,0) (1,1) (0,0) (1,1) 1 1 0 0</pre> </div> <div class="jsk-margin-vertical-sm"> <h4 class="title">样例输出</h4> <pre class="jsk-text-danger jsk-text-default jsk-padding-vertical-xs">3 3<br><br>C++期末考试题。。。<br>基本输入输出,傻了。<br>那个括号完全可以当作字符输入然后不管他的嘤嘤嘤。<br>强行用gets带偏队友<br>然后又强行用字符串带偏队友<br>每说一句话要深思熟虑,否则就成为坑货了。。。</pre> <div class="cnblogs_code" onclick="cnblogs_code_show('fb513b67-0220-4d20-ab70-c4661ecabcf4')"> <img src="https://uploadfiles.nowcoder.com/images/20200330/8908544_1585554317263_BEE14B9FE62E4101C719260C64AA4C83"> <img src="https://uploadfiles.nowcoder.com/images/20200330/8908544_1585554317289_BE319C0086E6D58007898F5FCE19C980"> <div id="cnblogs_code_open_fb513b67-0220-4d20-ab70-c4661ecabcf4" class="cnblogs_code_hide"> <pre>#include &lt;bits/stdc++.h&gt; <span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std; typedef </span><span style="color: #0000ff;">long</span> <span style="color: #0000ff;">long</span><span style="color: #000000;"> ll; </span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> data { ll x</span>=<span style="color: #800080;">0</span>,y=<span style="color: #800080;">0</span><span style="color: #000000;">; ll dist</span>=<span style="color: #800080;">0</span><span style="color: #000000;">; ll ans</span>=<span style="color: #800080;">0</span><span style="color: #000000;">; }; ll fun(ll x1,ll x2,ll y1,ll y2) { </span><span style="color: #0000ff;">return</span> (x1-x2)*(x1-x2)+(y1-y2)*(y1-<span style="color: #000000;">y2); } </span><span style="color: #0000ff;">char</span> s[<span style="color: #800080;">100005</span>]= {<span style="color: #800080;">0</span><span style="color: #000000;">}; </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main() { ios::sync_with_stdio(</span><span style="color: #0000ff;">false</span><span style="color: #000000;">); </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> n,m; </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> e,f,g; </span><span style="color: #0000ff;">while</span>(cin&gt;&gt;n&gt;&gt;m&amp;&amp;n&amp;&amp;<span style="color: #000000;">m){ </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i; data a[</span><span style="color: #800080;">1005</span><span style="color: #000000;">]; data b[</span><span style="color: #800080;">1005</span><span style="color: #000000;">]; </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">1</span>; i&lt;=n; i++) cin&gt;&gt;e&gt;&gt;a[i].x&gt;&gt;f&gt;&gt;a[i].y&gt;&gt;<span style="color: #000000;">g; </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">1</span>; i&lt;=m; i++) cin&gt;&gt;e&gt;&gt;b[i].x&gt;&gt;f&gt;&gt;b[i].y&gt;&gt;<span style="color: #000000;">g; </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">1</span>; i&lt;=m; i++<span style="color: #000000;">) { ll si; cin</span>&gt;&gt;<span style="color: #000000;">si; b[i].dist</span>=si*<span style="color: #000000;">si; } </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> j; </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">1</span>; i&lt;=m; i++<span style="color: #000000;">) { </span><span style="color: #0000ff;">for</span>(j=<span style="color: #800080;">1</span>; j&lt;=n; j++<span style="color: #000000;">) { ll dd</span>=<span style="color: #000000;">fun(a[j].x,b[i].x,a[j].y,b[i].y); </span><span style="color: #0000ff;">if</span>(dd&lt;=b[i].dist) b[i].ans++<span style="color: #000000;">; } } </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">1</span>; i&lt;m; i++) cout&lt;&lt;b[i].ans&lt;&lt;<span style="color: #800000;">"</span> <span style="color: #800000;">"</span><span style="color: #000000;">; cout</span>&lt;&lt;b[i].ans&lt;&lt;<span style="color: #000000;">endl; } </span><span style="color: #0000ff;">return</span> <span style="color: #800080;">0</span><span style="color: #000000;">; }</span></pre> </div> <span class="cnblogs_code_collapse">View Code</span> </div> <p>&nbsp;</p> <pre class="jsk-text-danger jsk-text-default jsk-padding-vertical-xs"><br><br></pre> </div> </div>