送水 C++
送水
https://ac.nowcoder.com/acm/problem/22241
#include <iostream> #include <cmath> #include <algorithm> #include <vector> using namespace std; int main(){ int Y, k, n, flag = 1; cin >> Y >> k >> n; if(Y > n) cout << -1; for(int i = 1; i <= n / k; ++i){ if(i * k < Y) continue; else{ cout << i * k - Y << ' '; flag = 0; }; } if(flag) cout << -1; return 0; }