锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
1錛夋睙嫻峰競鐢佃瘽鍙風爜鏄?浣嶆暟錛屾瘡涓浣嶄笂鐨勬暟鐮佸彲浠ユ槸0錛?錛?···8錛?涓換鎰忎竴涓紙鏁板瓧鍙互閲嶅鍑虹幇錛屽00000涔熺畻涓涓數璇濆彿鐮侊級錛岄偅涔堣繖涓煄甯傛渶澶氭湁澶氬皯涓數璇濆彿鐮侊紵
錛?錛夌敤0錛?錛?錛?榪?涓暟瀛楋紝鍙互緇勬垚澶氬皯涓病鏈夐噸澶嶇殑4浣嶆暟錛?
錛?錛?#8220;IMO”鏄浗闄呭ゥ鏋楀尮鍏嬬殑緙╁啓錛屾妸3涓瓧姣嶅啓鎴?縐嶄笉鍚岀殑棰滆壊錛岀幇鍦ㄦ湁5縐嶄笉鍚岀殑棰滆壊絎旓紝鎸変笂榪拌姹傝兘鍐欏嚭澶氬皯縐嶄笉鍚岄鑹叉惌閰嶇殑“IMO”.
絳旀鏄?span style="COLOR: #ffffff">錛?1) 100000縐?nbsp;
錛?錛?8縐?nbsp;
錛?錛?0縐?br>
涓嶈繃濂藉儚浜鴻剳瑕佹瘮鐖嗘悶鏇村揩浜?#8230;…ft
]]>
Time Limit: 1000MS |
|
Memory Limit: 30000K |
Total Submissions: 1342 |
|
Accepted: 587 |
Description
Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible,there is also a need to schedule all the taxi rides which have been booked in advance.Given a list of all booked taxi rides for the next day, you want to minimise the number of cabs needed to carry out all of the rides.
For the sake of simplicity, we model a city as a rectangular grid. An address in the city is denoted by two integers: the street and avenue number. The time needed to get from the address a, b to c, d by taxi is |a - c| + |b - d| minutes. A cab may carry out a booked ride if it is its first ride of the day, or if it can get to the source address of the new ride from its latest,at least one minute before the new ride's scheduled departure. Note that some rides may end after midnight.
Input
On the first line of the input is a single positive integer N, telling the number of test scenarios to follow. Each scenario begins with a line containing an integer M, 0 < M < 500, being the number of booked taxi rides. The following M lines contain the rides. Each ride is described by a departure time on the format hh:mm (ranging from 00:00 to 23:59), two integers a b that are the coordinates of the source address and two integers c d that are the coordinates of the destination address. All coordinates are at least 0 and strictly smaller than 200. The booked rides in each scenario are sorted in order of increasing departure time.
Output
For each scenario, output one line containing the minimum number of cabs required to carry out all the booked taxi rides.
Sample Input
2
2
08:00 10 11 9 16
08:07 9 16 10 11
2
08:00 10 11 9 16
08:06 9 16 10 11
Sample Output
1
2
Source
鏍規嵁榪欓亾棰樼洰鐨勬剰鎬濓紝鎴戜滑鍙互寤轟竴寮犲浘錛屽浜庝袱涓?/span>booked taxi ride錛?/span>ri鍜?/span>rj濡傛灉涓杈嗚濺鑳藉鍏堝畬鎴?/span>ri鐨勪換鍔″啀鏈夋椂闂磋刀鍘誨畬鎴?/span>rj鐨勪換鍔★紝閭d箞灝卞緩绔嬩竴鏉?/span>ri鎸囧悜rj鐨勮竟銆?br>
鎸夌収棰樼洰鐨勮姹傦紝瑕侀夋嫨鏈灝戠殑taxi鏉ュ畬鎴愯繖浜涗換鍔°傛樉鐒跺湪涓婇潰榪欎釜渚嬪瓙涓紝闇瑕佸畨鎺?/span>2杈?/span>taxi銆傜粨鍚堣繖涓浘錛屽彲浠ユ妸棰樼洰鐨勮姹傝漿鍖栦負鎵懼嚭鏈灝戠殑璺緞鏉℃暟錛屼嬌寰楄繖浜涜礬寰勮鐩栭斾腑鎵鏈夌殑杈癸紝渚嬪鍙互閫夋嫨2鏉¤礬寰?/span>1->3->4鍜?/span>1->2灝卞彲浠ヨ鐩栨墍鏈夌殑杈廣備篃鍙互閫夋嫨1->3->4鍜?/span>2錛堝洜涓?/span>2浣滀負鍒濆绔欙紝涓嶉渶瑕佺敱1杞Щ榪囨潵錛夈傚浜庝竴鏉¤繛緇殑璺緞vi1->vi2->…vik鐢變簬榪欐潯璺緞涓婄殑浠誨姟瀹為檯涓婃槸鐢變竴杈?/span>taxi鏉ュ畬鎴愮殑錛屽彲浠ュ惂榪欐潯璺緞閫鍖栨垚涓や釜鐐?/span>vi1->vik銆傛湁浜嗚繖涓ゆ寤哄浘鐨勬楠や互鍚庯紝闂鐨勬眰瑙e氨鍙互鍙樹負鎵懼嚭欏剁偣闆嗙殑涓涓渶灝忓瓙闆嗭紝浣胯繖涓《鐐瑰瓙闆嗚鐩栨墍鏈夌殑杈癸紙姣忔潯杈歸兘鑷沖皯鍜屼竴涓《鐐歸泦鐨勯《鐐圭浉榪烇級銆傝繖涓棶棰樺氨鏄浘鐨勬渶灝忕偣瑕嗙洊銆傚啀鐪嬭繖寮犲浘錛岃繕鏈変竴浜涙ц川鑳藉璁╂垜浠洿濂藉湴姹傚嚭鏈灝忕偣瑕嗙洊銆傝繖涓浘鏄竴涓湁鍚戞棤鐜浘錛屾病鏈夎嚜鐜紝灝卞彲浠ユ媶鐐癸紝鎶婂師鍏堝緩鐨勫浘鍙樻垚涓寮犱簩鍒嗗浘銆?br>
鍙互鍐嶅浘涓湅鍑猴紝涓婇潰涓懼嚭鐨勪竴鏉¤礬寰?/span>1->3->4瀵瑰簲浜嗚繖涓簩鍒嗗浘涓殑璺緞1->
寰?#8220;璁$畻鏈哄浘褰㈠”鍜?#8220;璁$畻鏈哄浘鍍忓鐞?#8221;鏄袱闂ㄥ緢鏈夋剰鎬濈殑璇劇▼銆傝繖瀛︽湡鎴戜滑鐨勮紼嬪畨鎺掕繕鏄竴璐綔椋?/p>
鈥斺旇紼嬪帇緙╋紝鎶婅繖涓ら棬璇劇▼鍘嬫垚浜嗕竴闂ㄨ紼嬶紝涓嶄粎濡傛榪樹嬌鐢ㄧ殑鏄唴閮ㄦ暀鏉愶紙浼犺涓殑鍐呴儴鏁欐潗灝辨槸鎶?/p>
璇劇▼鍐呭榪涗竴姝ョ簿綆鍘嬬緝錛夈傚嵆渚垮湪榪欑鎯呭喌涔嬩笅錛屾垜榪樻槸瀵硅綆楁満鍥懼艦鍥懼儚澶勭悊鍏呮弧鐑儏錛屾兂澶氬浜涗笢
瑗匡紝濂藉ソ鍦板仛璇劇▼璁捐銆備粖澶╀復涓嬭鍓嶏紝鑰佸笀鎶婅紼嬭璁$殑棰樼洰甯冪疆涓嬫潵錛岀湡浠ゆ垜褰誨簳澶辨湜浜嗐傚竷緗簡20+
涓鐩紝铏借娑夊強涓浜涘啗浜嬶紝浣嗘槸瑕佹眰鐪熺殑寰堟按銆傚悗闈㈢粰鍑轟簡涓緋誨垪鍐涗簨鐢靛獎錛岀伨闅劇數褰卞ぇ鐗囷紝鍋氭硶灝辨槸
錛?br>1銆佺湅鐗囷紱
2銆佹埅鍥句笌PS錛?br>3銆佸啓鎶ュ憡涓庡仛ppt銆?br> 鎴戞兂浜嗕竴涓嬶紝榪欓噷闈㈠彲鑳戒竴鐐圭悊璁猴紝涓鐐圭紪紼嬮兘涓嶄細娑夊強鍒幫紝榪欐牱鐨勮紼嬭璁★紝鐜╄繃鐢佃剳鐨勪漢閮戒細鍋氾紝榪?/p>
騫插槢娣誨湪“淇℃伅宸ョ▼”涓撲笟鐨?#8220;璇劇▼璁捐”閲屽憿錛熺湡鏄彲絎戯紒錛侊紒璇劇▼閮界緝姘寸緝鍒拌繖縐嶇▼搴︿簡錛岄偅榪樺紑浠
涔堣鍛紝鑷嬈轟漢緗簡銆傜◢鏈夌偣鏈笓涓氱煡璇嗙殑浜轟篃涓嶈嚦浜庝細璁や負璁$畻鏈哄浘鍍忓鐞嗗氨鏄帺PS鍚с傞偅澶у閲屽
鐢靛瓙宸ョ▼鐨勬瘯涓氬悗閮藉幓淇井娉㈢倝錛岄氫俊宸ョ▼鐨勫幓鍗栫數璇濆崱錛屼俊鎭伐紼嬬殑灝卞幓鐓х浉棣嗗仛PS濂戒簡銆?br>鍞?#8230;…榪欏嚑澶╂鏄柊鐢熷叆瀛︼紝榪樼湅鐫涓鎵逛竴鎵圭殑鏂扮敓寰鎴戜滑瀹胯垗榪欒竟璧幫紝鎴戝績閲岀湡鏄毦榪囷紝鐪熸兂璺熶粬浠
錛?#8220;鍥炲幓鍚э紝璇翠笉瀹氭潵騫磋繕鑳借冧釜娓呭崕銆?#8221;榪樻湁閭d箞澶氬闀匡紝閫佷釜瀛╁瓙涓婂ぇ瀛﹀涓嶅鏄擄紝浣嗕篃璁鎬粬浠繕涓嶇煡閬擄紝浠栦滑鐨勫効瀛愯鎺ュ彈榪欐牱鐨勬暀鑲層傛兂鐫榪欎簺浜嬶紝蹇冮兘鍦ㄧ棝鍟娿?br> 鎮?#8230;…
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 574 | Accepted: 229 |
Description
Input
Output
Sample Input
4 1 2 10 2 3 10 3 3 10 1 3 10 6 1 20 1000 3 25 10000 5 15 5000 22 300 5500 10 295 9000 7 7 6000 8 32 251 2261 123 281 1339 211 235 5641 162 217 7273 22 139 7851 194 198 9190 119 274 878 122 173 8640 0
Sample Output
30 25500 38595
Source
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 211 | Accepted: 82 |
Description
Input
Output
Sample Input
4 10.00000 0.00000 0.00000 -10.00000 -10.00000 0.00000 22.23086 0.42320 -4.87328 11.92822 1.76914 27.57680 156.71567 -13.63236 139.03195 -22.04236 137.96925 -11.70517 129.400249 -44.695226 122.278798 -53.696996 44.828427 -83.507917
Sample Output
4 6 23 100
Source
棰樼洰澶ф剰鏄粰鍑轟笁涓偣鐨?x,y)鍧愭爣錛岃姹傝緭鍑轟竴涓竟鏁版渶灝忕殑姝e杈瑰艦鐨勮竟鏁幫紝浣胯繖涓変釜鐐規伆濂藉湪
榪欎釜姝e杈瑰艦涓婇潰銆傚叾瀹炶繖涓笁瑙掑艦鍜岃繖涓澶氳竟褰㈡槸鍏卞鎺ュ渾錛岀敱澶栨帴鍦嗙殑鍦嗗績鍑哄彂錛屼笁瑙掑艦鐨勪笁
鏉¤竟鍙互鎶婂渾鍒嗘垚涓変喚錛屾瘡浠藉渾寮ф墍瀵瑰簲鐨勫渾蹇冭鍒嗗埆涓篴rg[0],arg[1]鍜宎rg[2]錛屾澶氳竟褰㈡妸鍦嗗姬
鍒嗘垚鐩哥瓑鐨刵浠斤紝姣忎喚瀵瑰簲鐨勫渾蹇冭涓?*pi/n銆傚叾瀹炰笁瑙掑艦鐨勪笁涓灝卞垎鍒崰鐢ㄤ簡鑻ュ共絳変喚姝e杈瑰艦
鎵鍒掑垎鐨勫渾寮э紝鏈鍚庝篃灝卞彧瑕佹眰arg[0],arg[1],arg[2]鍜?*pi鐨勬渶澶у叕綰︽暟(gcd)鍗沖彲銆備絾鏄繖閲屾槸
涓搴﹂兘鏄誕鐐規暟錛屾墍浠ヨ繕瀹氫箟涓涓誕鐐規暟鐨刧cd錛岃綆楁誕鐐規暟鐨刧cd鍙互鍒╃敤math.h鐨勫嚱鏁癴mod
(x,y)琛ㄧずx%y銆備緥濡?.5%0.3=0.2錛寈%y鐨勭粨鏋滀負涓嶈秴榪噛鐨勪竴涓誕鐐規暟銆備笅闈㈠啓浜嗕竴涓猣mod(x,y)鑷繁
鐨勫疄鐜般?br>double fmod(double x, double y)
{
return x-floor(x/y)*y;
}
鏈変簡fmod鍑芥暟浠ュ悗錛屽氨鍙互鐢ㄥ畠鏉ユ眰gcd浜嗭紒
double fgcd(double a, double b)
{
double t;
if(dblcmp(a-b) == 1) //a>b
{
t=a;
a=b;
b=t;
}
if(dblcmp(a) == 0) return b;
return fgcd(fmod(b,a),a);
}