hdu-1173(最短距離)
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1173
思路:最短距離:就是現將x,y從小到大排序,然後去中間點就行了。(注意:本題答案不唯一)
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 1000200; double x[maxn],y[maxn]; int main(void) { int n,i; while(~scanf("%d",&n)&&n) { for(i=0;i<n;i++) scanf("%lf%lf",&x[i],&y[i]); sort(x,x+n); sort(y,y+n); printf("%.2lf %.2lf\n",x[n/2],y[n/2]); } return 0; }
相關推薦
hdu-1173(最短距離)
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1173 思路:最短距離:就是現將x,y從小到大排序,然後去中間點就行了。(注意:本題答案不唯一) #include<iostream> #include<cstdio> #incl
一個人的旅行 HDU - 2066 (最短路)
mis 一個人 ssi 輸出 int cstring col 個數 cto 一個人的旅行 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su
2017多校訓練賽第四場 HDU 6071(最短路)
Lazy Running Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 101 Accepted S
HDU 6290(最短路)
高玩小Q不僅喜歡玩尋寶遊戲,還喜歡一款升級養成類遊戲。在這個遊戲的世界地圖中一共有n個城鎮,編號依次為1到n。這些城鎮之間有m條單向道路,第i 條單項道路包含四個引數ui,vi,ai,bi,表示一條從ui號城鎮出發,在vi號城鎮結束的單向道路,因為是單向道路,這不意味著小Q可以從vi沿著該道路走到ui。小Q的
hdu 2544(最短路)
Problem Description 在每年的校賽裡,所有進入決賽的同學都會獲得一件很漂亮的t-shirt。但是每當我們的工作人員把上百件的衣服從商店運回到賽場的時候,卻是非常累的!所以現在他們想要尋找最短的從商店到賽場的路線,你可以幫助他們嗎? Input
HDU 4786(最小生成樹 kruskal)
desc cpp using tran soft fine put sea can 題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=4786 Problem Description Coach Pang is
hdu 2544(最短路徑)
cst cstring while span code 最短路徑 bre sha nbsp 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #inclu
hdu 5521 Meeting(最短路)
names n) can style air ima pid hid con 題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=5521 題意:有1-n共n個點,給出m個塊(完全圖),並知道塊內各點之間互相到達花費時
hdu-3294(最長回文子串)
pre har solution mes pos 最長 chan ret 最長回文子串 題意:給你一個字符和一個字符串讓你求出最長回文子串並且輸出來,答案需要根據給出的字符轉換一下,就是將給出的字符認定為a,然後依次向後推; 解題思路:manacher模板+一些處理 代碼:
Pleasant sheep and big big wolf HDU - 3046(最小割)
Pleasant sheep and big big wolf Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s)
Golden Eggs HDU - 3820(最小割)
Golden Eggs Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 673 &nb
Going Home HDU - 1533(最大費用最小流)
compute eight mat only nts tor between all ans On a grid map there are n little men and n houses. In each unit time, every little man can
A - 繼續暢通工程 HDU - 1879 (最小生成樹)
A - 繼續暢通工程 HDU - 1879 省政府“暢通工程”的目標是使全省任何兩個村莊間都可以實現公路交通(但不一定有直接的公路相連,只要能間接通過公路可達即可)。現得到城鎮道路統計表,表中列出了任意兩城鎮間修建道路的費用,以及該道路是否已經修通的狀態。現請你編寫程
hdu 3251(最小割+輸出割邊)
大致題意: 有一個國家,有許多城市,一條道路連線兩個城市,拆掉這條路的花費為w,國王居住在城市1,因為你拯救了國家,所以國王現在要獎賞你一些城市,可選的城市有f個,每個城市都有一定的價值,當你選擇一些城市之後要拆掉一些道路使得國王不能從城市1走到你所選的任一個城市,現在問你
hdu 1081 (最大子矩陣和)dp To The Max
Problem Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of
HDU-5521 Meeting(最短路)
HDU-5521 Meeting (最短路) 題目大意 給標記從1-n的節點,並且進行了分塊(分塊可能會有重合),第i個分塊內部有sis_isi個節點,節點兩兩之間都有路徑相連,通過的時間都是tit_iti。現在一頭奶牛從節點1出發,另一頭從n出發,想找一箇
hdu 1690 Bus System(最短路)
題目意思:給出各個長度和花費,然後給出n,m, 接下來n行每行一個數,代表0到城市i的距離。注意這些城市是在一條直線上的。然後詢問m個城市間的最小花費。 思路:用flody求一下就行,注意開lon
Codeforces Round #339 (Div. 2)-C(點到線段的最短距離)
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it doe
hdu 3007(最小圓覆蓋)
題意:給平面上的一些點,用半徑最小的圓把所有點覆蓋了。 1、在點集中任取三個點A、B、C。 2、做一個包含ABC三點的最小圓,圓周可能通過這三點,也可能只通過其中兩點,但包含第三個點。後一種情況圓周上的兩點一定是位於圓周直徑的兩端。 3、在點集中找出距離第2步所建圓圓心最
繼續暢通工程 HDU - 1879(最小生成樹)
#include <stdio.h> #include <algorithm> using namespace std; struct Node { int a, b; int w