各位神犇们,这道题怎样更优化?
  • 板块灌水区
  • 楼主Wendy_Hello_qwq
  • 当前回复7
  • 已保存回复11
  • 发布时间2024/4/2 19:12
  • 上次更新2024/4/2 20:59:34
查看原帖
各位神犇们,这道题怎样更优化?
1039211
Wendy_Hello_qwq楼主2024/4/2 19:12

P1028 [NOIP2001 普及组] 数的计算

#include <cstdio>
using namespace std;
int h[1005];
int main()
{
//	freopen ("calculate.in", "r", stdin);
//	freopen ("calculate.out", "w", stdout);
	int n = 0;
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		h[i] = 1;
		for (int j = 1; j <= i / 2; j++) h[i] += h[j];
	}
	printf ("%d", h[n]);
	return 0;
//	fclose (stdin); fclose (stdout);
}
2024/4/2 19:12
加载中...