当前位置:网站首页>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;
}
边栏推荐
- C. colonne Swapping [tri + Simulation]
- 深度聚类:将深度表示学习和聚类联合优化
- mac版php装xdebug环境(m1版)
- Data storage 3
- Flask1.1.4 Werkzeug1.0.1 源碼分析:啟動流程
- Pytorch builds neural network to predict temperature
- [cloud native] what is the microservice architecture?
- If you don't know these four caching modes, dare you say you understand caching?
- Interview skills of software testing
- 产业金融3.0:“疏通血管”的金融科技
猜你喜欢
苹果cms V10模板/MXone Pro自适应影视电影网站模板
SAP ABAP BDC (batch data communication) -018
老板总问我进展,是不信任我吗?(你觉得呢)
Understand the deserialization principle of fastjson for generics
【SQL实战】一条SQL统计全国各地疫情分布情况
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
cf:C. Column Swapping【排序 + 模擬】
Harmonyos practice - Introduction to development, analysis of atomized services
PTA 天梯赛练习题集 L2-004 搜索树判断
How to improve website weight
随机推荐
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core
Flask 1.1.4 werkzeug1.0.1 analyse du code source: processus de démarrage
The solution of a simple algebraic problem
【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
mac版php装xdebug环境(m1版)
Input of native applet switches between text and password types
JVM命令之 jstat:查看JVM統計信息
SubGHz, LoRaWAN, NB-IoT, 物联网
cf:C. Column Swapping【排序 + 模拟】
nVisual网络可视化
SQL Server 2008 各种DateTime的取值范围
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
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]
[cloud native] what is the microservice architecture?
SAP Spartacus checkout 流程的扩展(extend)实现介绍
ML's shap: Based on the adult census income binary prediction data set (whether the predicted annual income exceeds 50K), use the shap decision diagram combined with the lightgbm model to realize the
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
深度聚类:将深度表示学习和聚类联合优化
PTA 天梯赛练习题集 L2-002 链表去重
EMMC print cqhci: timeout for tag 10 prompt analysis and solution