Logo
(追記) (追記ここまで)

10181번 - Federation Favorites 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB76066063287.293%

문제

En route to Rigel 7, Chief Engineer Geordi Laforge and Data were discussing favorite numbers. Geordi exclaimed he preferred Narcissistic Numbers: those numbers whose value is the same as the sum of the digits of that number, where each digit is raised to the power of the number of digits in the number.

Data agreed that Narcissistic Numbers were interesting, but not as good as his favorite: Perfect Numbers. Geordi had never heard of a Perfect Number, so Data elaborated, “A positive integer is said to be Perfect if it is equal to the sum of its positive divisors less than itself. For example, 6 is Perfect because 6 = 1 + 2 + 3.”

Geordi began thinking about an algorithm to determine if a number was Perfect, but did not have the raw computing ability of Data. He needs a program to determine if a given number is Perfect.

Help Geordi write that program.

입력

Input consists of a single entry per line. Each line contains a single positive integer n, where 2 < n < 100000 for each case. A line containing -1 denotes the end of input and should not be processed.

출력

For each case, determine whether or not the number is Perfect. If the number is Perfect, display the sum of its positive divisors less than itself. The ordering of the terms of the sum must be in ascending order. If a number is not Perfect, print “<NUM> is NOT perfect.” where <NUM> is the number in question. There must be a single space between any words, symbols, or numbers in all output, with the exception of the period at the end of the sentence when a number is not perfect.

제한

예제 입력 1

6
12
28
-1

예제 출력 1

6 = 1 + 2 + 3
12 is NOT perfect.
28 = 1 +たす 2 +たす 4 +たす 7 +たす 14

힌트

출처

School > PLU High School Programming Contest > PLU 2014 > Novice 12번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /