Created
May 24, 2017 01:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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