fork download
  1. # phần này để đọc int khi file input của giám khảo có white space
  2. def does_contain_digits(inp):
  3. if len(inp) == 0:
  4. return False
  5. for c in inp:
  6. if '0' <= c and c <= '9':
  7. return True
  8. return False
  9. while True:
  10. inp = input()
  11. #print(len(inp))
  12. if does_contain_digits(inp):
  13. p = 0
  14. for c in inp:
  15. if '0' <= c and c <= '9':
  16. p = p * 10 + int(c)
  17. break
  18.  
  19. # thuật toán bắt đầu từ đây:
  20. x = 1
  21. y = 1
  22. current_product = 1
  23.  
  24. MAX = 100000
  25. while y <= MAX:
  26. current_product *= y
  27. while current_product > p:
  28. current_product //= x
  29. x += 1
  30. if current_product == p:
  31. print(x, y)
  32. break
  33. y += 1
Success #stdin #stdout 0.02s 9324KB
stdin
336237000107779450149150899863053055074287462192237886406639547064000598862952490521796860533014572823802253217909006719621742372706728725882050596659868079110975411138483962679938508346084223207271792996283268944087761842281406928202932735464242785184851594398913456201359779481106052765110732849811913411176664047464310404414004075844147117854752806527707703799137449625986831614054560288169513617823061186339018288110843505197027879621937810551386486381192202704615236003835875328040763485566194123386753232451105462204780357574994936441538991794481098119557221916767010244613779179482637193549320811533841971240889642801608345443371173132254119561961267863939890858337704495876853280478521651701108085941350295579031896279162073345716099401607234573622911161651958473296500896084657795335824784903030237993040661165462387935452367825135290698190040434147320098383649238748574833493209528062381197277370039650128059455320658467098672711635850537500035531942762588635220312405979250580612424310564113612800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 
stdout
11 500