Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- long double F(int n) {
- if (n == 0) return 1;
- if (n > 0 && n <= 10) return F(n - 1);
- if (n > 10 && n < 100) return 2.2 * F(n - 3);
- return 1.7 * F(n - 2);
- }
- int main() {
- // freopen("input.txt", "r", stdin);
- int n = 40;
- cout << int(F(40));
- // 2 + 6 + 5 + 5 = 18
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement