当前位置:网站首页>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;
}
边栏推荐
- MySQL performance_ Schema common performance diagnosis query
- Three level menu data implementation, nested three-level menu data
- PTA ladder game exercise set l2-002 linked list de duplication
- Storage of dental stem cells (to be continued)
- Ten stages of becoming a Senior IC Design Engineer. What stage are you in now?
- [InstallShield] Introduction
- 从“跑分神器”到数据平台,鲁大师开启演进之路
- 深度聚类:将深度表示学习和聚类联合优化
- MFC BMP sets the resolution of bitmap, DPI is 600 points, and gdiplus generates labels
- STM32 key state machine 2 - state simplification and long press function addition
猜你喜欢

Dynamic memory management

Introduction to the extension implementation of SAP Spartacus checkout process

From "running distractor" to data platform, Master Lu started the road of evolution
![R language [logic control] [mathematical operation]](/img/93/06a306561e3e7cb150d243541cc839.png)
R language [logic control] [mathematical operation]

The boss always asks me about my progress. Don't you trust me? (what do you think)

@pathvariable 和 @Requestparam的详细区别

JVM命令之 jstack:打印JVM中线程快照

Bypass open_ basedir

PTA 天梯赛练习题集 L2-004 搜索树判断

《ClickHouse原理解析与应用实践》读书笔记(6)
随机推荐
JVM命令之 jstat:查看JVM统计信息
Bat instruction processing details
驱动开发中platform设备驱动架构详解
Value range of various datetimes in SQL Server 2008
如何提高网站权重
What EDA companies are there in China?
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
EMMC打印cqhci: timeout for tag 10提示分析与解决
PTA ladder game exercise set l2-004 search tree judgment
Apple CMS V10 template /mxone Pro adaptive film and television website template
10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
数据中心为什么需要一套基础设施可视化管理系统
PTA ladder game exercise set l2-002 linked list de duplication
【SQL实战】一条SQL统计全国各地疫情分布情况
Detailed explanation of platform device driver architecture in driver development
Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou
Red Hat安装内核头文件
The solution of a simple algebraic problem
Harmonyos practice - Introduction to development, analysis of atomized services
SAP ABAP BDC (batch data communication) -018