fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int f(unsigned int a, unsigned int m){
  6. int n = 0;
  7. if(m - 2*a != 0){
  8. n ++;
  9. f(a+1, m - a);
  10. }
  11. else{
  12. n ++;
  13. return n;
  14. }
  15. }
  16. int main() {
  17. int n, a, m;
  18. cin>>a>>m;
  19. cout<<f(a, m);
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
5 25
stdout
1