fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  5. #define el '\n';
  6. #define yes cout << "yes" << el;
  7. #define no cout << "no" << el;
  8.  
  9. int l,r;
  10. ll sum;
  11. void next(int l,int r)
  12. {
  13. if(l == r + 1) return;
  14. if(4 - l >= 0){
  15. sum+=4;
  16. next(l+1,r);
  17. }
  18. else if(7 - l >= 0){
  19. sum+=7;
  20. next(l+1,r);
  21. }
  22. }
  23. int main()
  24. {
  25. FIO;
  26.  
  27. // Moneer's coding space
  28. cin >> l >> r;
  29. next(l,r);
  30. cout << sum << el;
  31.  
  32. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
4