URAL 1893. A380 (阅读理解 + 模拟)

16 篇文章 0 订阅

1893. A380

Time limit: 1.0 second
Memory limit: 64 MB
There was no limit to Jack's joy! He managed to buy on the Internet tickets to the ICPC semifinal contest, which was to be held very soon in the mysterious overseas city of Saint Petersburg. Now he was going to have a transoceanic flight in the world largest passenger aircraft Airbus A380.
Jack started studying the aircraft seating chart in Wikipedia, so that he would be able to ask for a nice window seat at check-in. Or maybe he would ask for an aisle seat—he hadn't decided yet.
Airbus A380 has two decks with passenger seats. The upper deck is for premium and business class passengers. The premium class section embraces the first and second rows. Each row contains four seats identified by letters from A to D. The aisles in this section are between the first and second seats and between the third and fourth seats of each row. The rows from the third to the twentieth are for business class passengers. There are six seats in each row, and they are identified by letters from A to F. The aisles are between the second and third and between the fourth and fifth seats of each row.
The lower deck is reserved for economy class passengers. The rows are numbered from 21 to 65. Each row contains ten seats identified by letters from A to K (the letter I is omitted). The aisles are between the third and fourth seats and between the seventh and eighth seats of each row.
Help Jack determine if a seat is next to the window or next to the aisle given the seat designation.

Input

The only line contains a seat designation: the row number and the letter identifying the position of the seat in the row.

Output

If the seat is next to the window, output “window”. Otherwise, if the seat is next to the aisle, output “aisle”. If neither is true, output “neither”.

Samples

input output
3C
aisle
64A
window
21F
neither




解析:直接按照题意模拟即可,必要时画出图有助直观解题。



AC代码:

#include <cstdio>
#include <string>
#include <iostream>
using namespace std;

int main(){
    #ifdef sxk
        freopen("in.txt", "r", stdin);
    #endif //sxk

    string s;
    while(cin>>s){
        int ans = 0, len = s.size();
        char f = s[len-1];
        for(int i=0; i<len-1; i++)  ans = ans * 10 + s[i] - '0';
        if(ans <= 2){                                 //高级
            if(f == 'A' || f == 'D') puts("window");
            else if(f == 'B' || f == 'C') puts("aisle");
            else puts("neither");
        }
        else if(ans >=3 && ans <=20){                 //商务
            if(f == 'A' || f == 'F') puts("window");
            else if(f >= 'B' && f <= 'E') puts("aisle");
            else puts("neither");
        } 
        else if(ans >= 21 && ans <= 65){              //经济
            if(f == 'A' || f == 'K') puts("window"); 
            else if(f == 'C' || f == 'D' || f == 'G' || f == 'H')
                puts("aisle");
            else puts("neither");
        }
        else puts("neither");
    }
    return 0;
}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值