码迷,mamicode.com
首页 > 其他好文 > 详细

URAL 1893. A380(模拟啊 )

时间:2015-03-08 10:31:52      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:ural   模拟   

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1893


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

PS:

读懂题就很简单;

代码如下:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
    char s[17];
    while(~scanf("%s",&s))
    {
        char c;
        int len = strlen(s);
        c = s[len-1];
        int num = 0;
        for(int i = 0; i < len-1; i++)
        {
            num = num*10+(s[i]-'0');
        }
        //printf("num:%d c:%c\n",num,c);
        if(num <= 2)//头等舱
        {
            if(c=='A' || c=='D')
            {
                printf("window\n");
            }
            else if(c=='B' || c=='C')
            {
                printf("aisle\n");
            }
        }
        else if(num > 2 && num <= 20)//商务舱
        {
            if(c=='A' || c=='F')
            {
                printf("window\n");
            }
            else if(c=='B' || c=='C' || c=='D' || c=='E')
            {
                printf("aisle\n");
            }
            else
            {
                printf("neither\n");
            }
        }
        else
        {
            if(c=='A' || c=='K')
            {
                printf("window\n");
            }
            else if(c=='C' || c=='D' || c=='G' || c=='H')
            {
                printf("aisle\n");
            }
            else
            {
                printf("neither\n");
            }
        }
    }
    return 0;
}
/*
3C
64A
21F
*/


URAL 1893. A380(模拟啊 )

标签:ural   模拟   

原文地址:http://blog.csdn.net/u012860063/article/details/44131233

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!