Advertisement
dimuster

4188

Oct 20th, 2022
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. long double F(int n) {
  6.     if (n == 0) return 1;
  7.     if (n > 0 && n <= 10) return F(n - 1);
  8.     if (n > 10 && n < 100) return 2.2 * F(n - 3);
  9.     return 1.7 * F(n - 2);
  10. }
  11.  
  12. int main() {
  13. //    freopen("input.txt", "r", stdin);
  14.    
  15.     int n = 40;
  16.     cout << int(F(40));
  17.     // 2 + 6 + 5 + 5 = 18
  18.    
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement