Algorithm: Implement
code:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<vector>
#include<utility>
#include<map>
#include<list>
#include<queue>
#include<stack>
using namespace std;
vector<int> V;
map<int,int> M;
set<int> S;
int main()
{
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/
int k,y,n;
cin >> y >> k >> n;
bool isok = true;
for(int i=1; i*k<=n;i++)
{
if(i*k-y>=1 && i*k<=n)
{
isok= false;
cout << i*k-y << " ";
}
}
if(isok)
cout << -1 << endl;
return 0;
}
Không có nhận xét nào:
Đăng nhận xét