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)
-
Let explain one input. a = -202202202202202202 and b =-101.Make partition of a such that the partition is divisible by b. Look 202 is divi...
-
/*** Md. Namzul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
-
Problem Explanation Problem Category : Medium Algorithm: Binary Search, Mathematical Simulation For this problem, if you know how to f...
No comments:
Post a Comment