konchin_shih

p1

May 27th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. from math import *
  2.  
  3. while True:
  4.     n = int(input()) - 1
  5.  
  6.     a = floor(sqrt(n))
  7.  
  8.     x = 1
  9.     y = a + 1
  10.  
  11.     b = n - a * a
  12.  
  13.     if b < a:
  14.         x = b + 1
  15.         y = a + 1
  16.     else:
  17.         x = a + 1
  18.         y = 2 * a - b + 1
  19.  
  20.     print(f"{x}排{y}個")
Advertisement
Add Comment
Please, Sign In to add comment