Title Link: http://acm.timus.ru/problem.aspx?space=1&num=1893
1893. A380time limit:1.0 Second
Memory limit:64 MB
There is no limit to Jack ' s joy! He managed to buy on the Internet tickets to the ICPC semifinal contest, which is to being held very soon in the mysterious Overseas City of Saint Petersburg. Now he is going to has a transoceanic flight in the world largest passenger aircraft Airbus A380. Jack started studying the aircraft seating chart in Wikipedia, so that he would being able to ask for a nice window seat at c Heck-in. Or Maybe he would ask for an aisle Seat-he hadn ' t decided yet. Airbus A380 has a 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 is between the first and second seats and between the third and fourth seats of each row. The rows from the third to the twentieth is for business class passengers. There is six seats in each row, and they is identified by letters from A to f. The aisles is 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 is between the third and fourth seats and between the seventh and eighth seats of each row. Help Jack determine if a seat are next to the window or next to the aisle given the seat designation. Inputthe contains a seat designation:the row number and the letter identifying the position of the seat in the Row. Outputif 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:
It's easy to read a question.
The code is as follows:
#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)//First Class {if (c== ' A ' | | c== ' D ') {printf ("window\n"); } else if (c== ' B ' | | c== ' c ') {printf ("aisle\n"); }} else if (num > 2 && num <= 20)//Business class {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;} /*3c64a21f*/
URAL 1893. A380 (analog AH)