5 条题解
-
1limingjie LV 8 @ 2022-4-9 10:17:18
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int n,m,ans; void f(int last,int step) { if(last/2+1<step) return; if( 0 == step) { ans++; return ; } for(int i =last;i >=1;i--) f(i-2,step - 1); } int main() { cin >> n >> m; f(n,m); cout<< ans<<endl; return 0; }
-
02022-1-9 17:36:09@
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int n,m,ans; void f(int last,int step) { if(last/2+1<step) return; if(0==step) { ans++; return; } for(int i=last;i>=1;i--) f(i-2,step-1); } int main() { cin>>n>>m; f(n,m); cout<<ans<<endl; return 0; }
-
02021-12-11 21:04:46@
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <algorithm> #include <iomanip> #include <stack> using namespace std; #define LL long long const int N =1e5+10; const int INF =0x3f3f3f3f; int n,m,ans; void f(int last ,int step){ if(last/2+1<step) return; if(0== step){ ans++; return; } for(int i=last;i>=1;i--) f(i-2,step-1); } int main(){ cin>>n>>m; f(n,m); cout<<ans<<endl; return 0; }
-
02021-12-11 21:04:15@
C++ #include <iostream> #include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <algorithm> #include <iomanip> #include <stack> using namespace std; #define LL long long const int N =1e5+10; const int INF =0x3f3f3f3f; int n,m,ans; void f(int last ,int step){ if(last/2+1<step) return; if(0== step){ ans++; return; } for(int i=last;i>=1;i--) f(i-2,step-1); } int main(){ cin>>n>>m; f(n,m); cout<<ans<<endl; return 0; }
-
02021-12-11 21:03:21@
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int n,m,ans; void f(int last,int step) { if(last/2+1<step) return; if(0==step) { ans++; return; } for(int i=last;i>=1;i--) f(i-2,step-1); } int main() { cin>>n>>m; f(n,m); cout<<ans<<endl; return 0; }
- 1
信息
- ID
- 1484
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 151
- 已通过
- 61
- 上传者