QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22468. 牛隻夥伴

Statistics

Bessie 和其他所有牛隻的耳朵上都有一個 RFID 序號標籤,以便 FJ 用機器清點牠們。許多牛都有一個「夥伴」,其序號等於這頭牛自身序號的所有因數(不包括該數本身)之和。有些牛沒有夥伴,因為沒有牛的序號與牠們的因數之和相等。

有些牛有超級夥伴。如果兩頭牛的序號使牠們互為夥伴,就稱牠們是超級夥伴。自己是自己的超級夥伴的牛會被排斥;不要考慮牠們!

給定一個序號 $S$($6 \le S \le 18,000$),找出序號至少為 $S$ 且擁有超級夥伴的第一頭牛。

例如,考慮序號 $220$,它的因數為 $1,2,4,5,10,11,20,22,44,55,110$,總和為 $284$。同樣地,$284$ 的因數為 $1,2,4,71,142$,總和為 $220$。

輸入格式

  • 第 1 行:一個整數 $S$。

輸出格式

  • 第 1 行:一行中兩個以空格分隔的整數,分別是序號不小於 $S$ 的第一頭擁有超級夥伴的牛的序號,以及牠的夥伴的序號。

範例

輸入格式 1

206

輸出格式 1

220 284

題目來源:Traditional,2010

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.