题目链接

递推就行,把a[0]设为1很巧妙。

 

#include <cstdio>
#include <iostream>
using namespace std;
int a[1005]={1};
int main()
{
    for(int i=1;i<=1000;i++)
    for(int j=0;j<=i/2;j++)
    a[i]+=a[j];
    int n;
    while(cin>>n)
    cout<<a[n]<<endl;
    return 0;
}

 

相关文章:

  • 2022-01-02
  • 2021-08-09
  • 2021-05-19
  • 2021-08-19
  • 2022-01-02
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-11-12
相关资源
相似解决方案