[Codeforces Round #148 (Div. 2)]A. Two Bags of Potatoes

地址:http://codeforces.com/contest/239/problem/A

按题目说的求就是了

 

 1 #include<stdio.h>
 2 
 3 int y,k,n;
 4 
 5 int main()
 6 {
 7     int i;
 8     scanf("%d %d %d",&y,&k,&n);
 9     i=(y/k+1)*k-y;
10     if(i>n-y) printf("-1\n");
11     else
12     {
13         while(i<=n-y)
14         {
15             printf("%d ",i);
16             i=i+k;
17         }
18     }
19     return 0;
20 }

 

posted @ 2013-01-21 18:01  tjsuhst  阅读(163)  评论(0编辑  收藏  举报