fork download
  1. // C++ program to find minimum steps to reach
  2. // starting position in a circular tour.
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5.  
  6. // function for finding minimum steps
  7. int minStroke(int n, int m)
  8. {
  9. // return value n / gcd(n, m)
  10. return (n/__gcd(n, m));
  11. }
  12.  
  13. // Driver function
  14. int main()
  15. {
  16. int n = 11, k = 2, m = 5;
  17. cout << minStroke(n, m);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4180KB
stdin
Standard input is empty
stdout
11