Skip to content

Instantly share code, notes, and snippets.

@hiterm
Created December 23, 2016 05:41
Show Gist options
  • Save hiterm/d51367851194a11ef2011d230997a083 to your computer and use it in GitHub Desktop.
Save hiterm/d51367851194a11ef2011d230997a083 to your computer and use it in GitHub Desktop.
# 全ての点を通るので、
# w, hに対して、距離は (w + 1)(h + 1) - 1 = wh + w + h になる
# 片方を固定して数え上げ
import math
n = int(input())
s = 0
i = 1
while (n - i) // i + 1 >= 1:
s += (n - i) // (i + 1)
i += 1
print(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment