fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. void podzielnosc ()
  7. {
  8. int t, n, x, y, i, j;
  9. cin>>t;
  10.  
  11. for (i=0; i<t; ++i)
  12. {
  13. cin>>n>>x>>y;
  14.  
  15. for (j=0; j<n; j++)
  16. {
  17. if ((j%x == 0) && (j%y != 0))
  18. {
  19. cout<<j<<" ";
  20. }
  21. }
  22. cout << endl;
  23. }
  24. }
  25.  
  26.  
  27. int main()
  28. {
  29. podzielnosc();
  30. }
  31.  
Success #stdin #stdout 0s 4316KB
stdin
2 
7 2 4
35 5 12
stdout
2 6 
5 10 15 20 25 30