codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

437A.md (2412B)


      1 Source: https://codeforces.com/problemset/problem/437/A
      2 
      3 A. The Child and Homework
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
     22 
     23 Fortunately the child knows how to solve such complicated test. The child will follow the algorithm:
     24 
     25 * If there is some choice whose description at least twice shorter than all other descriptions, or at least twice longer than all other descriptions, then the child thinks the choice is great.
     26 * If there is exactly one great choice then the child chooses it. Otherwise the child chooses C (the child think it is the luckiest choice).
     27 
     28 You are given a multiple-choice questions, can you predict child's choose?
     29 
     30 Input
     31 
     32 The first line starts with "A." (without quotes), then followed the description of choice A. The next three lines contains the descriptions of the other choices in the same format. They are given in order: B, C, D. Please note, that the description goes after prefix "X.", so the prefix mustn't be counted in description's length.
     33 
     34 Each description is non-empty and consists of at most 100 characters. Each character can be either uppercase English letter or lowercase English letter, or "_".
     35 
     36 Output
     37 
     38 Print a single line with the child's choice: "A", "B", "C" or "D" (without quotes).
     39 
     40 Examples
     41 
     42 Input
     43 
     44 ```
     45 A.VFleaKing_is_the_author_of_this_problem  
     46 B.Picks_is_the_author_of_this_problem  
     47 C.Picking_is_the_author_of_this_problem  
     48 D.Ftiasch_is_cute
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 D
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 A.ab  
     61 B.abcde  
     62 C.ab  
     63 D.abc
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 C
     70 ```
     71 
     72 Input
     73 
     74 ```
     75 A.c  
     76 B.cc  
     77 C.c  
     78 D.c
     79 ```
     80 
     81 Output
     82 
     83 ```
     84 B
     85 ```
     86 
     87 Note
     88 
     89 In the first sample, the first choice has length 39, the second one has length 35, the third one has length 37, and the last one has length 15. The choice D (length 15) is twice shorter than all other choices', so it is great choice. There is no other great choices so the child will choose D.
     90 
     91 In the second sample, no choice is great, so the child will choose the luckiest choice C.
     92 
     93 In the third sample, the choice B (length 2) is twice longer than all other choices', so it is great choice. There is no other great choices so the child will choose B.