fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int fx(int x, int y, int z) {
  5. if (x < y) {
  6. return 1 + fx(x+1, y, z);
  7. } else if (y < z) {
  8. return 2 + fx(x, y + 1, z);
  9. } else {
  10. return z;
  11. }
  12. }
  13. int main(){
  14. cout << fx(12,14,20);
  15. return 0;
  16. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
40