5 条题解

  • 3
    @ 2025-2-5 15:17:56
    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int f(int x){
    	if(x==0) return 1;
    	if(x==1) return 1;
    	if(x==2) return 2;//2+0,1+1
    	if(x==3) return 2;//1+1+1,2+1
    	return  f(x-2)+f(x-3);
    } 
    int main()
    { 
    	cin>>n;
    	cout << f(n);
    	return 0;
    }
    

    信息

    ID
    215
    时间
    1000ms
    内存
    64MiB
    难度
    10
    标签
    递交数
    4
    已通过
    4
    上传者