Advertisement
Teodor92

Apples

Nov 20th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System;
  2.  
  3. class Apples
  4. {
  5. static void Main()
  6. {
  7. string[] input = Console.ReadLine().Split();
  8. int y = int.Parse(input[0]);
  9. int k = int.Parse(input[1]);
  10. int n = int.Parse(input[2]);
  11. int rangeOfX = n - y;
  12. int counter = 0;
  13. for (int i = 1; i < rangeOfX + 1; i++)
  14. {
  15. if ((i+y)%k==0)
  16. {
  17. Console.Write("{0} ", i);
  18. counter++;
  19. }
  20. }
  21. if (counter == 0 || rangeOfX < 0)
  22. {
  23. Console.WriteLine(-1);
  24. }
  25. Console.WriteLine();
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement