#include<cstdio>
using namespace std;
int n,cnt=1;
void func(int x)
{
for(int i=1;i<=x/2;i++)
{ cnt++; func(i); }
}
int main()
{
scanf("%d",&n );
func(n);
printf("%d\n",cnt);
}
Addition: Is it a time to accumulate counts when i=1, 2, 3?
Addition: The input data is a question on the 6th valley. .
+7Votes
That’s for sure, cnt is a global variable, as long as it is executed cyclically, it will add 1 on the previous basis, regardless of how many times the function runs