cf148div2
来源:互联网 发布:王者荣耀引流源码 编辑:程序博客网 时间:2024/06/06 02:36
Valera had two bags of potatoes, the first of these bagscontains
Help Valera to determine how many potatoes could be in the firstbag. Print all such possible numbers in ascending order.
The first line of input contains threeintegers
Print the list of whitespace-separated integers — all possiblevalues of
If there are no such values of
10 1 10
-1
10 6 40
2 8 14 20 26
题意:求(x+y)%k==0中x可能的取值。
#include
#include
#include
using namespace std;
int main()
{ int y,n,k;
while(scanf("%d%d%d",&y,&k,&n)!=EOF)
{ int flag=0;
for(int i=k;i<=n;i+=k)
{ if(i>y)
{ printf("%d ",i-y); flag=1; }
} if(flag==0) { printf("-1"); } printf("\n"); } return 0;}