codeforces-scrape

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

910B.md (1626B)


      1 Source: https://codeforces.com/problemset/problem/910/B
      2 
      3 B. Door Frames
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Petya has equal wooden bars of length *n*. He wants to make a frame for two equal doors. Each frame has two vertical (left and right) sides of length *a* and one top side of length *b*. A solid (i.e. continuous without breaks) piece of bar is needed for each side.
     22 
     23 Determine a minimal number of wooden bars which are needed to make the frames for two doors. Petya can cut the wooden bars into any parts, but each side of each door should be a solid piece of a wooden bar (or a whole wooden bar).
     24 
     25 Input
     26 
     27 The first line contains a single integer *n* (1 ≤ *n* ≤ 1 000) — the length of each wooden bar.
     28 
     29 The second line contains a single integer *a* (1 ≤ *a* ≤ *n*) — the length of the vertical (left and right) sides of a door frame.
     30 
     31 The third line contains a single integer *b* (1 ≤ *b* ≤ *n*) — the length of the upper side of a door frame.
     32 
     33 Output
     34 
     35 Print the minimal number of wooden bars with length *n* which are needed to make the frames for two doors.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 8  
     43 1  
     44 2
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 1
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 5  
     57 3  
     58 4
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 6
     65 ```
     66 
     67 Input
     68 
     69 ```
     70 6  
     71 4  
     72 2
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 4
     79 ```
     80 
     81 Input
     82 
     83 ```
     84 20  
     85 5  
     86 6
     87 ```
     88 
     89 Output
     90 
     91 ```
     92 2
     93 ```
     94 
     95 Note
     96 
     97 In the first example one wooden bar is enough, since the total length of all six sides of the frames for two doors is 8.
     98 
     99 In the second example 6 wooden bars is enough, because for each side of the frames the new wooden bar is needed.