当前位置:网站首页>3428. 放苹果
3428. 放苹果
2022-07-07 01:09:00 【Ray.C.L】

思路:dfs
代码:
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n, m;
int dfs(int u, int sum, int last){
if(u == n){
if (sum == 0) return 1;
return 0;
}
int res = 0;
for(int i = last; i <= sum; i++)
res += dfs(u+1, sum - i , i);
return res;
}
int main()
{
while(cin >> m >> n)
cout << dfs(0, m, 0) << endl;
return 0;
}
边栏推荐
- Say sqlyog deceived me!
- Bypass open_ basedir
- [SQL practice] a SQL statistics of epidemic distribution across the country
- CMD permanently delete specified folders and files
- Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
- JVM命令之 jstack:打印JVM中线程快照
- R language [logic control] [mathematical operation]
- A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
- Get the way to optimize the one-stop worktable of customer service
- Chain storage of stack
猜你喜欢

CTFshow--常用姿势
![[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core](/img/19/1a6d43c39f2cf810ba754ea9674426.png)
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core

Get the way to optimize the one-stop worktable of customer service

Reading notes of Clickhouse principle analysis and Application Practice (6)

Ctfshow-- common posture

从“跑分神器”到数据平台,鲁大师开启演进之路

驱动开发中platform设备驱动架构详解

Check point: the core element for enterprises to deploy zero trust network (ztna)

JVM the truth you need to know

Say sqlyog deceived me!
随机推荐
CMD permanently delete specified folders and files
原生小程序 之 input切换 text与password类型
980. 不同路径 III DFS
Understand the deserialization principle of fastjson for generics
PowerPivot - DAX (function)
线性回归
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server
Vscode for code completion
老板总问我进展,是不信任我吗?(你觉得呢)
Solve pod install error: FFI is an incompatible architecture
Jstat of JVM command: View JVM statistics
【日常训练--腾讯精选50】292. Nim 游戏
Ctfshow-- common posture
Reading notes of Clickhouse principle analysis and Application Practice (6)
Flask1.1.4 Werkzeug1.0.1 源码分析:启动流程
[solved] record an error in easyexcel [when reading the XLS file, no error will be reported when reading the whole table, and an error will be reported when reading the specified sheet name]
《ClickHouse原理解析与应用实践》读书笔记(6)
Reptile exercises (III)
Web authentication API compatible version information
Interview questions and salary and welfare of Shanghai byte