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

14784번 - Bedtime Reading, II 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB111383233.684%

문제

Bessie rubbed her eyes again. "The headache's gone. Can you go over that part about number chains again, Farmer John?"

"Sure!" FJ exclaimed. "Let's continue with that sigma function, the one that is the sum of a number's divisors. First, though, let's exclude the number itself from the sum and call our new function bess(), in your honor. Now bess(12) = 1+2+3+4+6 = 16. If we continue and compute bess(16), we find it is 1 +たす 2 +たす 4 +たす 8 = 15. Then bess(15) = 1 + 3 + 5 = 9 and bess(9) = 1 + 3 = 4. Then bess(4) = 1 + 2 = 3 and bess(3) = 1. For better or worse, bess(1) is 0. Not much of a chain, really."

"But look," continued FJ. "We see that bess(6) = 1 + 2 + 3 = 6 and bess(28) = 28. Those form little tiny chains called 'perfect numbers'. Moving to bigger numbers, bess(220) = 284 and -- get this -- bess(284) = 220 -- a chain of length 2! Some chains are even longer."

"It's so late; I'm not sure I can do the math," mooed Bessie.

"No problem," said FJ. "We'll ask the programmers to write a program that accepts a start and end integer (1 <= start <= end <= 1,000,000) and finds all the possible number chains whose starting value is in the interval (start..end). No intermediate value is allowed to exceed 2,000,000, though some might be larger than the 'end' integer. No chain is longer than 50 elements. Print only chains whose smallest element comes first (i.e., no intermediate value is less than the start value of the chain). We must ask them, though, to compute the answers with their program and not just print them. We'll supply test data that is reasonable to finish in 1.0 CPU seconds."

입력

  • Line 1: Two space-separated integers: start and end

출력

  • Lines 1..?: Each line contains a space-separated list that represents one chain of numbers calculated using the described bess() function.

제한

예제 입력 1

200 1200

예제 출력 1

220 284
496
1184 1210

힌트

출처

Olympiad > USA Computing Olympiad > 2005-2006 Season > USACO US Open 2006 Contest > Bronze 4번

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

출처

대학교 대회

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

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