185. Pleasing Numbers

Codeforces
IDCF10269185
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You consider a number to be a _pleasing number_ if it contains no prime factors other than 2 and 3. For example, 1, 4, 12, 18, and 81 are pleasing numbers, while 7, 28, 210, and 30 are not pleasing numbers. Given a number, figure out whether or not it is a _pleasing number_. The only line of input consists of a single positive integer $n$ less than or equal to 1000. If $n$ is a pleasing number, as described above, output "YES" (no quotes). Otherwise, output "NO" (no quotes). ## Input The only line of input consists of a single positive integer $n$ less than or equal to 1000. ## Output If $n$ is a pleasing number, as described above, output "YES" (no quotes). Otherwise, output "NO" (no quotes). [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $, $ n \leq 1000 $. **Constraints** $ n \geq 1 $ **Objective** Determine whether all prime factors of $ n $ are in $ \{2, 3\} $. That is, $ n $ is a pleasing number if and only if $ n = 2^a \cdot 3^b $ for some $ a, b \in \mathbb{N}_0 $.
API Response (JSON)
{
  "problem": {
    "name": "185. Pleasing Numbers",
    "description": {
      "content": "You consider a number to be a _pleasing number_ if it contains no prime factors other than 2 and 3. For example, 1, 4, 12, 18, and 81 are pleasing numbers, while 7, 28, 210, and 30 are not pleasing nu",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269185"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You consider a number to be a _pleasing number_ if it contains no prime factors other than 2 and 3. For example, 1, 4, 12, 18, and 81 are pleasing numbers, while 7, 28, 210, and 30 are not pleasing nu...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $, $ n \\leq 1000 $.\n\n**Constraints**  \n$ n \\geq 1 $\n\n**Objective**  \nDetermine whether all prime factors of $ n $ are in $ \\{2, 3\\} $.  \nThat is, $ n $ is a ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments