21 lines
634 B
Python
21 lines
634 B
Python
# HumanEval/84
|
|
# Loki Mode Multi-Agent Solution
|
|
# Attempts: 1
|
|
# Passed: True
|
|
|
|
def solve(N):
|
|
"""Given a positive integer N, return the total sum of its digits in binary.
|
|
|
|
Example
|
|
For N = 1000, the sum of digits will be 1 the output should be "1".
|
|
For N = 150, the sum of digits will be 6 the output should be "110".
|
|
For N = 147, the sum of digits will be 12 the output should be "1100".
|
|
|
|
Variables:
|
|
@N integer
|
|
Constraints: 0 ≤ N ≤ 10000.
|
|
Output:
|
|
a string of binary number
|
|
"""
|
|
digit_sum = sum(int(d) for d in str(N))
|
|
return bin(digit_sum)[2:] |