I. Goofy Numbers

Codeforces
IDCF72I
Time2000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
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_. Some numbers are really interesting. Commander Surena defines some interesting properties for non-negative integers: * An integer is happy if it is divisible by at least one of its digits and not by all of them. * An integer is happier if it is divisible by all of its digits. * An integer is upset if it's divisible by none of its digits. Surena asks you to find out if a given number is happy, happier or upset. ## Input Input contains a single non-negative integer _n_ (1 ≤ _n_ ≤ 108). ## Output Write on a single line the type of the integer: _happy_, _happier_ or _upset_. Print the type in lowercase letters. [samples] ## Note In the second test 29994 is only divisible by 2. In the third test 23 is a prime number.
非负整数 #cf_span[a] 是非负整数 #cf_span[b] 的因数,当且仅当存在一个 *正* 整数 #cf_span[c] 使得 #cf_span[a × c = b]。 某些数字非常有趣。指挥官 Surena 为非负整数定义了一些有趣的性质: Surena 要求你判断给定的数字是 happy、happier 还是 upset。 输入包含一个非负整数 #cf_span[n](#cf_span[1 ≤ n ≤ 108])。 请在一行中输出该整数的类型:_happy_、_happier_ 或 _upset_。请用小写字母打印类型。 在第二个测试中,#cf_span[29994] 仅能被 #cf_span[2] 整除。 在第三个测试中,#cf_span[23] 是一个质数。 ## Input 输入包含一个非负整数 #cf_span[n](#cf_span[1 ≤ n ≤ 108])。 ## Output 请在一行中输出该整数的类型:_happy_、_happier_ 或 _upset_。请用小写字母打印类型。 [samples] ## Note 在第二个测试中,#cf_span[29994] 仅能被 #cf_span[2] 整除。在第三个测试中,#cf_span[23] 是一个质数。
**Definitions** Let $ n \in \mathbb{Z}_{\geq 0} $. Let $ D(n) = \{ d \in \mathbb{Z}^+ \mid d \mid n \} $ denote the set of positive divisors of $ n $. Let $ \sigma(n) = |D(n)| $ denote the number of positive divisors of $ n $. **Constraints** $ 1 \leq n \leq 10^8 $ **Objective** Classify $ n $ as: - **happy**, if $ \sigma(n) = 2 $, - **happier**, if $ \sigma(n) = 3 $, - **upset**, otherwise.
Samples
Input #1
99
Output #1
happier
Input #2
29994
Output #2
happy
Input #3
23
Output #3
upset
API Response (JSON)
{
  "problem": {
    "name": "I. Goofy Numbers",
    "description": {
      "content": "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_. Some numbers are really interesting. Comman",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF72I"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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_.\n\nSome numbers are really interesting. Comman...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "非负整数 #cf_span[a] 是非负整数 #cf_span[b] 的因数,当且仅当存在一个 *正* 整数 #cf_span[c] 使得 #cf_span[a × c = b]。\n\n某些数字非常有趣。指挥官 Surena 为非负整数定义了一些有趣的性质:\n\nSurena 要求你判断给定的数字是 happy、happier 还是 upset。\n\n输入包含一个非负整数 #cf_span[n](#cf...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}_{\\geq 0} $.  \nLet $ D(n) = \\{ d \\in \\mathbb{Z}^+ \\mid d \\mid n \\} $ denote the set of positive divisors of $ n $.  \nLet $ \\sigma(n) = |D(n)| $ denote the numbe...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments