2015-06-11 20:00:59
【传送门】
A题:数学题,简单枚举。
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <string> #include <iostream> #include <algorithm> using namespace std; #define getmid(l,r) ((l) + ((r) - (l)) / 2) #define MP(a,b) make_pair(a,b) #define PB(a) push_back(a) typedef long long ll; typedef pair<int,int> pii; const double eps = 1e-8; const int INF = (1 << 30) - 1; ll x,y,k,n; int main(){ scanf("%I64d%I64d%I64d",&y,&k,&n); bool flag = false; for(int i = 1; ; ++i){ x = (ll)i * k - y; if(x + y > n) break; if(x >= 1){ printf("%I64d ",x); flag = true; } } if(!flag) printf("-1\n"); else puts(""); return 0; }