Title Description
Description
Bessie and all the other cows have a radio frequency identification (RFID) serial number tag on their ears. So the farmer John can calculate their number mechanically. Many cows have a "Nou You". If the sum of the serial numbers of cow A is exactly equal to the serial number of cow B, then the Nou You of A is B. Here, a number's "approximate" does not include the number itself.
Because some cows are numbered and larger than any other cow's number, these cows are not Nou You. And some cows have a "very good friend", when two cows each other "Nou You", they are a pair of "very good friends." Note In this question, ignore those who are their own "very good friends" situation.
Given a serial number S (6≤s≤18,000), locate the first cow with a "very good friend" with a serial number not less than S.
For example, consider the serial number 220, which is approximate 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, and 110, and 284. Similarly, 284 of the approximate is 1, 2, 4, 71, and 142, their and is 220. So 220 and 284 are a pair of very good friends.
Enter a description
Input Description
Line 1th: A separate integer s, which is the given sequence number.
Output description
Output Description
Line 1th: 2 integers A and b, separated by a space. A indicates the serial number of a cow with a very good friend whose first serial number is not less than S, and B is the serial number of his "very good friend".
Sample input
Sample Input
206
Sample output
Sample Output
220 284
Code:
#include <cstdio>//a water problemusing namespacestd;intN;intFintx) { intans=0; for(intI=1; i<=x/2; i++) if(x%i==0) ans+=i; returnans;}intMain () {inti; scanf ("%d",&N); for(I=n;; i++) { intt=f (i); if(f (t) ==i&&t!=i) {printf ("%d%d", i,t); return 0;; } } return 0;}
Codevs 2632 very good friends