A. Display Size

Codeforces
IDCF747A
Time1000ms
Memory256MB
Difficulty
brute forcemath
English · Original
Chinese · Translation
Formal · Original
A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly _n_ pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels _a_ and the number of columns of pixels _b_, so that: * there are exactly _n_ pixels on the display; * the number of rows does not exceed the number of columns, it means _a_ ≤ _b_; * the difference _b_ - _a_ is as small as possible. ## Input The first line contains the positive integer _n_ (1 ≤ _n_ ≤ 106) — the number of pixels display should have. ## Output Print two integers — the number of rows and columns on the display. [samples] ## Note In the first example the minimum possible difference equals 2, so on the display should be 2 rows of 4 pixels. In the second example the minimum possible difference equals 0, so on the display should be 8 rows of 8 pixels. In the third example the minimum possible difference equals 4, so on the display should be 1 row of 5 pixels.
一家大公司决定推出一系列矩形显示屏,并决定显示屏必须恰好有 #cf_span[n] 个像素。 你的任务是确定矩形显示屏的尺寸——即像素的行数 #cf_span[a] 和列数 #cf_span[b],使得: 第一行包含正整数 #cf_span[n](#cf_span[1 ≤ n ≤ 106])——显示屏应具有的像素数量。 请输出两个整数——显示屏的行数和列数。 在第一个例子中,最小可能的差值为 2,因此显示屏应为 2 行,每行 4 个像素。 在第二个例子中,最小可能的差值为 0,因此显示屏应为 8 行,每行 8 个像素。 在第三个例子中,最小可能的差值为 4,因此显示屏应为 1 行,每行 5 个像素。 ## Input 第一行包含正整数 #cf_span[n](#cf_span[1 ≤ n ≤ 106])——显示屏应具有的像素数量。 ## Output 请输出两个整数——显示屏的行数和列数。 [samples] ## Note 在第一个例子中,最小可能的差值为 2,因此显示屏应为 2 行,每行 4 个像素。在第二个例子中,最小可能的差值为 0,因此显示屏应为 8 行,每行 8 个像素。在第三个例子中,最小可能的差值为 4,因此显示屏应为 1 行,每行 5 个像素。
Given a positive integer $ n $ where $ 1 \leq n \leq 10^6 $, find integers $ a $ and $ b $ such that: - $ a \cdot b = n $, - $ a \leq b $, - $ b - a $ is minimized. Output: $ a $ and $ b $.
Samples
Input #1
8
Output #1
2 4
Input #2
64
Output #2
8 8
Input #3
5
Output #3
1 5
Input #4
999999
Output #4
999 1001
API Response (JSON)
{
  "problem": {
    "name": "A. Display Size",
    "description": {
      "content": "A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly _n_ pixels. Your task is to determine the size of the rectangular display — the 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": "CF747A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly _n_ pixels.\n\nYour task is to determine the size of the rectangular display — the nu...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "一家大公司决定推出一系列矩形显示屏,并决定显示屏必须恰好有 #cf_span[n] 个像素。\n\n你的任务是确定矩形显示屏的尺寸——即像素的行数 #cf_span[a] 和列数 #cf_span[b],使得:\n\n第一行包含正整数 #cf_span[n](#cf_span[1 ≤ n ≤ 106])——显示屏应具有的像素数量。\n\n请输出两个整数——显示屏的行数和列数。\n\n在第一个例子中,最小可能的差值...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "Given a positive integer $ n $ where $ 1 \\leq n \\leq 10^6 $, find integers $ a $ and $ b $ such that:\n\n- $ a \\cdot b = n $,\n- $ a \\leq b $,\n- $ b - a $ is minimized.\n\nOutput: $ a $ and $ b $....",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments