The problem is from codeforces: http://www.codeforces.com/problemset/problem/239/A
It is a simple math problem: finding the numbers x that satisify where y, k, and n are given;
Or
y, k, n = map(int, raw_input().split()) L = [xy - y for xy in range(0, n + 1, k) if xy > y] if L : print ' '.join(map(str, L)) else : print -1
Or
y,k,n=map(int,raw_input().split()) start = y+(k-y%k) l=[] for i in range(start,n+1,k): l.append(i) if len(l): for x in l : print x-y, else: print -1
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
417 wordsloading...
Last Post: Algorithm Complexity
Next Post: Null Reference Exception due to Null String in C#