Skip to content

Instantly share code, notes, and snippets.

@ShaneRich5
Created May 24, 2017 01:42
Show Gist options
  • Save ShaneRich5/c3601c73aa2b0d34d873d685b2f91e14 to your computer and use it in GitHub Desktop.
Save ShaneRich5/c3601c73aa2b0d34d873d685b2f91e14 to your computer and use it in GitHub Desktop.
Solution to the Mansa Stones problem on Hackerrank. https://www.hackerrank.com/challenges/manasa-and-stones
for _ in xrange(test_cases):
n = int(raw_input()) - 1
a = int(raw_input())
b = int(raw_input())
low = a if a < b else b
high = a + b - low
diff = high - low
current, limit = low * n, high * n
if a == b:
print current
else:
result = ''
while current <= limit:
result += str(current ) + ' '
current += diff
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment