c++25分,后面超时,求优化
查看原帖
c++25分,后面超时,求优化
1028478
haomouren楼主2024/7/15 19:44
#include<bits/stdc++.h>
using namespace std;
long long n,cot=1;
void f(int n) {
	cot+=n/2;
	for(int i=1; i<=n/2; i++) {
		f(i);
	}
}
int main() {
	cin>>n;
	f(n);
	cout<<cot;
	return 0;
}
2024/7/15 19:44
加载中...