codeforces-scrape

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

72I.md (1195B)


      1 Source: https://codeforces.com/problemset/problem/72/I
      2 
      3 I. Goofy Numbers
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 The non-negative integer *a* is a divisor of the non-negative integer *b* if and only if there exists a positive integer *c* such that *a* × *c* = *b*.
     22 
     23 Some numbers are really interesting. Commander Surena defines some interesting properties for non-negative integers:
     24 
     25 * An integer is happy if it is divisible by at least one of its digits and not by all of them.
     26 * An integer is happier if it is divisible by all of its digits.
     27 * An integer is upset if it's divisible by none of its digits.
     28 
     29 Surena asks you to find out if a given number is happy, happier or upset.
     30 
     31 Input
     32 
     33 Input contains a single non-negative integer *n* (1 ≤ *n* ≤ 108).
     34 
     35 Output
     36 
     37 Write on a single line the type of the integer: happy, happier or upset. Print the type in lowercase letters.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 99
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 happier
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 29994
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 happy
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 23
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 upset
     75 ```
     76 
     77 Note
     78 
     79 In the second test 29994 is only divisible by 2.
     80 
     81 In the third test 23 is a prime number.