Codeforces: 239A. Two Bags of Potatoes


The problem is from codeforces: http://www.codeforces.com/problemset/problem/239/A

239A Codeforces: 239A. Two Bags of Potatoes algorithms beginner brute force codeforces greedy algorithm implementation java programming languages python

It is a simple math problem: finding the numbers x that satisify tex_b0a4fdf49d0830184730581cd795a1af Codeforces: 239A. Two Bags of Potatoes algorithms beginner brute force codeforces greedy algorithm implementation java programming languages python where y, k, and n are given; tex_7d1e348c2c23d8ca4945c44ad070c144 Codeforces: 239A. Two Bags of Potatoes algorithms beginner brute force codeforces greedy algorithm implementation java programming languages python

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 words
Last Post: Algorithm Complexity
Next Post: Null Reference Exception due to Null String in C#

The Permanent URL is: Codeforces: 239A. Two Bags of Potatoes

Leave a Reply