Monday, September 16, 2019

Codeforce A. Two Bags of Potatoes

  1. #include< iostream >
  2. using namespace std;
  3. int main()
  4. {
  5. int y, k, n;
  6. cin >> y >> k >> n;
  7. int x = k - y%k;
  8. if(x+y > n) return cout << -1 << endl , 0;
  9. for(int i = x ; i <= n-y; i+=k)
  10. cout << i << " ";
  11. return 0;
  12. }

No comments: