C. Vladik and fractions

Codeforces
IDCF743C
Time1000ms
Memory256MB
Difficulty
brute forceconstructive algorithmsmathnumber theory
English · Original
Chinese · Translation
Formal · Original
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer _n_ he can represent fraction as a sum of three distinct positive fractions in form . Help Vladik with that, i.e for a given _n_ find three distinct positive integers _x_, _y_ and _z_ such that . Because Chloe can't check Vladik's answer if the numbers are large, he asks you to print numbers not exceeding 109. If there is no such answer, print _\-1_. ## Input The single line contains single integer _n_ (1 ≤ _n_ ≤ 104). ## Output If the answer exists, print 3 distinct numbers _x_, _y_ and _z_ (1 ≤ _x_, _y_, _z_ ≤ 109, _x_ ≠ _y_, _x_ ≠ _z_, _y_ ≠ _z_). Otherwise print _\-1_. If there are multiple answers, print any of them. [samples]
Vladik 和 Chloe 决定谁更擅长数学。Vladik 声称,对于任意正整数 $n$,他都能将分数 $\frac{2}{n}$ 表示为三个互不相同的正分数之和,形式为 $\frac{1}{x} + \frac{1}{y} + \frac{1}{z}$。 请帮助 Vladik,即对于给定的 $n$,找出三个互不相同的正整数 $x$、$y$ 和 $z$,使得 $\frac{1}{x} + \frac{1}{y} + \frac{1}{z} = \frac{2}{n}$。由于 Chloe 无法在数字过大时验证 Vladik 的答案,他要求你输出的数字不超过 $10^9$。 如果不存在这样的答案,请输出 _-1_。 单行包含一个整数 $n$($1 ≤ n ≤ 10^4$)。 如果存在答案,请输出 $3$ 个互不相同的数 $x$、$y$ 和 $z$($1 ≤ x, y, z ≤ 10^9$,$x ≠ y$,$x ≠ z$,$y ≠ z$)。否则输出 _-1_。 如果存在多个答案,输出任意一个即可。 ## Input 单行包含一个整数 $n$($1 ≤ n ≤ 10^4$)。 ## Output 如果存在答案,请输出 $3$ 个互不相同的数 $x$、$y$ 和 $z$($1 ≤ x, y, z ≤ 10^9$,$x ≠ y$,$x ≠ z$,$y ≠ z$)。否则输出 _-1_。如果存在多个答案,输出任意一个即可。 [samples]
Given: - Integer $ n $, where $ 1 \leq n \leq 10^4 $. Find: - Three distinct positive integers $ x, y, z $, each $ \leq 10^9 $, such that $$ \frac{2}{n} = \frac{1}{x} + \frac{1}{y} + \frac{1}{z}. $$ If no such triple exists, output $-1$.
Samples
Input #1
3
Output #1
2 7 42
Input #2
7
Output #2
7 8 56
API Response (JSON)
{
  "problem": {
    "name": "C. Vladik and fractions",
    "description": {
      "content": "Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer _n_ he can represent fraction as a sum of three distinct positive fractions in form . ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF743C"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer _n_ he can represent fraction as a sum of three distinct positive fractions in form .\n...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Vladik 和 Chloe 决定谁更擅长数学。Vladik 声称,对于任意正整数 $n$,他都能将分数 $\\frac{2}{n}$ 表示为三个互不相同的正分数之和,形式为 $\\frac{1}{x} + \\frac{1}{y} + \\frac{1}{z}$。\n\n请帮助 Vladik,即对于给定的 $n$,找出三个互不相同的正整数 $x$、$y$ 和 $z$,使得 $\\frac{1}{x} + \\f...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "Given:  \n- Integer $ n $, where $ 1 \\leq n \\leq 10^4 $.  \n\nFind:  \n- Three distinct positive integers $ x, y, z $, each $ \\leq 10^9 $, such that  \n  $$\n  \\frac{2}{n} = \\frac{1}{x} + \\frac{1}{y} + \\fra...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments