台灣門牌排序 Taiwan address sorting

問題 Problem

拿到門牌清單, 怎麼樣排序最好?

We got a list of addresses. What is their best order?

理想排序 Ideal order

好看:

Looks good:

7號之2
7之3號平房樓頂
7-3號1樓
7號之5
7-5號1,2樓閣樓
8號
8-1號
8之9號
10號之1

方法 Method

怎麼弄得? 重點是號碼…

How did we do it? Well our focus is on the numbers...

垂直 Vertical

樓層採複選, 以維持:

By the way, the floor part of addresses is sorted in a separate round, to ensure:

1號2樓
1之1號

程式 Programs

輸入格式 Input format

若含鄰, 輸出就會按照鄰, 否則輸出就會純按照號碼(適合單條路)。

英文住址 English addresses

(Taiwan English_addresses are written in the opposite order: ...street, city, county... So do note if anyone one day writes a reversed version of this program to handle them, it would need to be smart enough to treat quirks like "No. 2-1, Lane 3" as "1, 2, 3"...)


積丹尼 Dan Jacobson

Last modified: 2021-04-26 06:56:06 +0800