codeforces-scrape

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

761A.md (1302B)


      1 Source: https://codeforces.com/problemset/problem/761/A
      2 
      3 A. Dasha and Stairs
      4 
      5 time limit per test
      6 
      7 2 seconds
      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 On her way to programming school tiger Dasha faced her first test — a huge staircase!
     22 
     23  ![](https://espresso.codeforces.com/34326935a965721f32f8203b55c38fdf9861d657.png) 
     24 
     25 The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their color. So on some interval of her way she calculated two values — the number of steps with even and odd numbers.
     26 
     27 You need to check whether there is an interval of steps from the *l*-th to the *r*-th (1 ≤ *l* ≤ *r*), for which values that Dasha has found are correct.
     28 
     29 Input
     30 
     31 In the only line you are given two integers *a*, *b* (0 ≤ *a*, *b* ≤ 100) — the number of even and odd steps, accordingly.
     32 
     33 Output
     34 
     35 In the only line print "YES", if the interval of steps described above exists, and "NO" otherwise.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 2 3
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 YES
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 3 1
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 NO
     61 ```
     62 
     63 Note
     64 
     65 In the first example one of suitable intervals is from 1 to 5. The interval contains two even steps — 2 and 4, and three odd: 1, 3 and 5.