from sys import stdin scan = lambda : stdin.readline() def gcd(a,b): if b==0: return a return gcd(b,a%b) while True: num = int(scan()) if num ==0: break sum=0 for i in range(1,num): for j in range(i+1,num+1): sum = sum + gcd(i,j) print(sum)
Subscribe to:
Post Comments (Atom)
-
Problem Explanation Category: Easy Type: String Ad Hoc This is simple string ad hoc problem. You just need to find out a substring of...
-
Suppose you have 24 and you need to find out all divisors of the number. The normally what we do? We just divide the number from 1 to 24. T...
-
Problem Explanation Category: Easy One have to find out maximum number of player which is even. Check the amount of left hand player...
No comments:
Post a Comment