当前位置:网站首页>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;
}
边栏推荐
- POI excel export, one of my template methods
- Go语学习笔记 - gorm使用 - 原生sql、命名参数、Rows、ToSQL | Web框架Gin(九)
- Go language context explanation
- 改变ui组件原有样式
- 数字IC面试总结(大厂面试经验分享)
- 【日常训练--腾讯精选50】292. Nim 游戏
- Sequential storage of stacks
- Interview questions and salary and welfare of Shanghai byte
- Career experience feedback to novice programmers
- linear regression
猜你喜欢
Financial risk control practice - decision tree rule mining template
Mac version PHP installed Xdebug environment (M1 version)
Bypass open_ basedir
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
Add salt and pepper noise or Gaussian noise to the picture
【日常训练--腾讯精选50】235. 二叉搜索树的最近公共祖先
C. colonne Swapping [tri + Simulation]
VScode进行代码补全
Modes of optical fiber - single mode and multimode
【SQL实战】一条SQL统计全国各地疫情分布情况
随机推荐
Mysql-centos7 install MySQL through yum
Question 102: sequence traversal of binary tree
Bat instruction processing details
Dynamic memory management
Apple CMS V10 template /mxone Pro adaptive film and television website template
Nvisual network visualization
POI excel export, one of my template methods
Things about data storage 2
980. Different path III DFS
产业金融3.0:“疏通血管”的金融科技
mac版php装xdebug环境(m1版)
职场经历反馈给初入职场的程序员
线性回归
[SQL practice] a SQL statistics of epidemic distribution across the country
Check Point:企业部署零信任网络(ZTNA)的核心要素
Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture
Jstat of JVM command: View JVM statistics
SubGHz, LoRaWAN, NB-IoT, 物联网
【FPGA教程案例13】基于vivado核的CIC滤波器设计与实现
Go language context explanation