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.