URAL 1893. A380(模拟啊 )

题目链接: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
*/
时间: 2024-08-01 22:39:43

URAL 1893. A380(模拟啊 )的相关文章

灵活利用单链表,顺带一提可持久化链表。

#include<stdio.h> /** 单链表 **/ /* 利用指针可以为直接映射到改变上 且后续的地址传递比较方便,永远不要对表头做操作.只赋值. */ struct Node { int val; Node * next; }; Node * Head,Last; void CreatList_L(int n) { Node *p,*q; Head = new Node(); Head->next = NULL; p = Head; while(n--) { q = new N

URAL 2002. Test Task(登陆模拟 map )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=2002 2002. Test Task Time limit: 0.5 second Memory limit: 64 MB It was an ordinary grim October morning. The sky was covered by heavy gray clouds. It was a little rainy. The rain drops fell on the win

FZU 1893 内存管理 模拟

比赛的时候队友要做这道题…… 他没做出来自己也被误导了…… 也算是个教训 自己还是要有自己的思路…… 又是模拟题…… 网上都是用vector做的 我最近才会stl 怎么会用那么高大上的的东西…… 强力模拟一波内存…… 反正只有100的大小 随意遍历…… 模拟都做不出来 只能说明真的方了…… 只要心态稳定 模拟都是水题…… 1 #include<stdio.h> 2 #include<string.h> 3 int memory[102]; 4 int room[102]; 5 in

URAL 1715. Another Ball Killer (大模拟)

1715. Another Ball Killer Time limit: 2.0 second Memory limit: 64 MB Contestants often wonder what jury members do during a contest. Someone thinks that they spend all the contest fixing bugs in tests. Others say that the jury members watch the conte

URAL 1762 Search for a Hiding-Place(数学&#183;模拟)

题意  你在一个n*m个白色正方形格子组成的矩形的某个顶点格子  你沿着45度角的方向走  到了边界就改变方向90度  每次经过一个格子都改变他原来的颜(白或灰)  求你走到另一个顶点格子时矩形中有多少格子是灰色的 这题可以用公式也可以直接模拟  模拟就是一直向右移n-1位 每次超过边界就可以把边界向右移m-1位  用cnt记录超过边界的次数 那么每次都会经过cnt个已经走过的格子 (每个格子最多经过2次)  答案也就减去2*cnt    直到刚好到达边界 #include <bits/stdc

URAL 1787 Turn for MEGA (贪心 + 模拟)

Turn for MEGA Time limit: 1.0 second Memory limit: 64 MB A traffic light at the turn for the "MEGA" shopping center from the Novomoskovskiy highway works in such a way that k cars are able to take a turn in one minute. At weekends all the reside

URAL 1404. Easy to Hack! (模拟)

space=1&num=1404">1404. Easy to Hack! Time limit: 1.0 second Memory limit: 64 MB When Vito Maretti writes an important letter he encrypts it. His method is not very reliable but it's enough to make any detective understand nothing in that lett

URAL 1712. Cipher Grille (模拟)

1712. Cipher Grille Time limit: 0.5 second Memory limit: 64 MB Our program committee uses different tools for problem development: a mailing list, a version control system, an administration system of the Timus Online Judge website, and many others.

URAL 1889. Airport Announcements 模拟题

1889. Airport Announcements Time limit: 1.0 second Memory limit: 64 MB Igor was bored of waiting in an airport lounge. Oceanic Airlines, a company he didn't like so much, delayed the departure of his flight, so he was late for the connection flight t