Contest2974 - [C3]-第六节课-递归2
2024-08-13 18:00:00
3333-08-13 22:00:00
信息与公告
#include<bits/stdc++.h> using namespace std; int ans = 0; int a[100]; int f(int n){ if(n == 1) return 1; if(a[n] == 0) { int sum = 0; for(int i = 1; i <= n/2; i ++){ if(a[i] == 0) a[i] = f(i); sum += a[i]; } a[n] = sum + 1; } return a[n]; } int main(){ int n; cin >> n; cout << f(n) - 1; }