When you use MS Excel, you will find that each column is labeled alphabet-ically (i.e., A, B, · · · , Z, AA, AB,· · · ). We can map the label of each column into an integer. For example, A → 1, B → 2, C → 3, D → 4, · · · , Z → 26,AA → 27, AB → 28, AC → 29, · · · , ZZ → 702, AAA → 703, AAB → 704,AAC → 705, · · ·
Figure out how the mapping procedure works, and write a function to implement it. For example, when the input is “AA”, your function should output 27.
當您使用MS Excel時,您將發現每列都按字母順序標記(即A,B,···,Z,AA,AB,···)。 我們可以將每列的標籤映射為整數。 例如,A→1,B→2,C→3,D→4,···,Z→26,AA→27,AB→28,AC→29,···,ZZ→702,AAA→703 ,AAB→704,AAC→705,···
找出映射過程的方法,並編寫一個實現它的函數。例如,當輸入為“AA”時,您的函數應輸出27。
Input consists of several lines of text. Each line upper case letters (i.e., A, B, AA, ABB,· · · ).
輸入包含好幾行文字。每行為大寫字母的組合(即A,B,AA,ABB,···)。
The output contains one line for each input text. Each line contains a mapping number.
每行輸入文字輸出一行。每行包含一個映射數字。
A AA AB ABE
1 27 28 733
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |