給定座位編號(如 3C, 64A),判斷屬於窗口、過道還是中間座位。空客 A380 雙層佈局規則固定,直接模擬即可。
| 區域 | 排數 | 座位字母 | 窗口 | 過道 | 中間 |
|---|---|---|---|---|---|
| 頭等艙 | 1-2 | A, B, C, D | A, D | B, C | - |
| 商務艙 | 3-20 | A-F | A, F | B, C, D, E | - |
| 經濟艙 | 21-65 | A-K (無 I) | A, K | C, D, G, H | B, E, F, J |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
while (cin >> s) {
int row = 0;
for (int i = 0; i < (int)s.size() - 1; i++)
row = row * 10 + (s[i] - '0');
char seat = s.back();
if (row <= 2) { // 頭等艙
if (seat == 'A' || seat == 'D') cout << "window";
else if (seat == 'B' || seat == 'C') cout << "aisle";
else cout << "neither";
} else if (row <= 20) { // 商務艙
if (seat == 'A' || seat == 'F') cout << "window";
else if (seat >= 'B' && seat <= 'E') cout << "aisle";
else cout << "neither";
} else if (row <= 65) { // 經濟艙
if (seat == 'A' || seat == 'K') cout << "window";
else if (seat == 'C' || seat == 'D' || seat == 'G' || seat == 'H') cout << "aisle";
else cout << "neither";
} else {
cout << "neither";
}
cout << '\n';
}
return 0;
}
3C → 商務艙 C → aisle 64A → 經濟艙 A → window 21F → 經濟艙 F → neither