URAL 1893. A380 (read comprehension + simulation)

Source: Internet
Author: User

URAL 1893. A380 (read comprehension + simulation)

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 wocould be able to ask for a nice window seat check-in. or maybe he wocould 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. inputThe only line 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




Analysis: directly simulate the problem based on the meaning of the question. If necessary, drawing helps to solve the problem intuitively.



AC code:

# Include
 
  
# Include
  
   
# Include
   
    
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
    
     
= 3 & ans <= 20) {// business if (f = 'A' | f = 'F') puts ("window "); else if (f >= 'B' & f <= 'E') puts ("aisle"); else puts ("neither ");} else if (ans> = 21 & ans <= 65) {// economical 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 ;}
    
   
  
 





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.