#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <time.h>
#include <queue>
#include <stack>
#include <cctype>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <sstream>
using namespace std;
int n,k,s;
int ans;
void gao(int now,int deep,int sum)
{
if(deep==k&&sum==s) {ans++;return ;}
if(deep>k||sum>s) return ;
else
for(int i=now+;i<=n;i++)
gao(i,deep+,sum+i);
return ;
}
int main()
{ while(scanf("%d%d%d",&n,&k,&s)!=EOF)
{
if(n+k+s==) break;
ans=;
for(int i=;i<=n;i++)
gao(i,,i);
printf("%d\n",ans);
}
return ;
}

UVALive 6661 Equal Sum Sets的更多相关文章

  1. UvaLive 6661 Equal Sum Sets (DFS)

    Let us consider sets of positive integers less than or equal to n. Note that all elements of a set a ...

  2. [UVALive 6661 Equal Sum Sets] (dfs 或 dp)

    题意: 求从不超过 N 的正整数其中选取 K 个不同的数字,组成和为 S 的方法数. 1 <= N <= 20  1 <= K<= 10  1 <= S <= 15 ...

  3. D.6661 - Equal Sum Sets

    Equal Sum Sets Let us consider sets of positive integers less than or equal to n. Note that all elem ...

  4. UvaLive6661 Equal Sum Sets dfs或dp

    UvaLive6661 PDF题目 题意:让你用1~n中k个不同的数组成s,求有多少种组法. 题解: DFS或者DP或打表. 1.DFS 由于数据范围很小,直接dfs每种组法统计个数即可. //#pr ...

  5. Equal Sum Sets

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=49406 题意: 输入n,k,s,求在不小于n的数中找出k个不同的数 ...

  6. HDU-3280 Equal Sum Partitions

    http://acm.hdu.edu.cn/showproblem.php?pid=3280 用了简单的枚举. Equal Sum Partitions Time Limit: 2000/1000 M ...

  7. HDU 3280 Equal Sum Partitions(二分查找)

    Equal Sum Partitions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  8. 698. Partition to K Equal Sum Subsets

    Given an array of integers nums and a positive integer k, find whether it's possible to divide this ...

  9. [LeetCode] 548. Split Array with Equal Sum 分割数组成和相同的子数组

    Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies fol ...

随机推荐

  1. Ubuntu server 搭建Git server【转】

    转自:http://www.cnblogs.com/candle806/p/4064610.html Ubuntu server 搭建Git server,git相比svn,最主要就是分布式了,每个客 ...

  2. SQL语句帮助大全

    --删除约束 Status:字段名 alter table Table_1 drop constraint Status; --添加约束 --Status :字段名 t_Pay_Order:表名 默认 ...

  3. trace spring

    package xx.com.aspect; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotati ...

  4. CEC2017 benchmark function调用接口

    CEC2017 benchmark function可以从这里下载. 导师最近给了个课题让我自己研究,跟智能优化算法相关的,必不可免的要用到最新的CEC2017 benchmark function, ...

  5. 一张图教会CSS3倒影

    分享 示例图片 在CSS3之前,想要实现示例图片这样的一个倒影效果一般只能通过处理图片的方式,而CSS3问世之后,想要实现这样的效果变得非常简单,只需一个CSS3属性就可以轻松实现了. 这就是今天所要 ...

  6. node练习笔记

    一.用http模块实现客户端 1.   这个错误的原因是:客户端http_client.js里面的端口和服务端里面的端口不一样 2.querystring.stringify  字符串转换成对象  q ...

  7. 洛谷P1972 HH的项链

    传送门啦 分析: 题目描述不说了,大意是,求一段区间内不同元素的种数. 看到区间,我们大概先想到的是暴力(然后炸掉).线段树.树状数组.分块. 下面给出的是一种树状数组的想法. 首先,对于每一段区间里 ...

  8. jquery 绑定,mvc和webform的三种方式

    asp.net里的绑定方式,on的绑定方式无效 $('#SelCommandType').bind('click', function () { }); mvc里的绑定方式 $('#DownList' ...

  9. (一)问候 HttpClient

    第一节: HttpClient 简介 HttpClient 是 Apache Jakarta Common 下的子项目,可以用来提供高效的.最新的.功能丰富的支持 HTTP 协议的客户端编程工具包,并 ...

  10. Python学习笔记:lambda表达式

    lambda表达式:通常是在需要一个函数,但又不想去命名一个函数的时候使用,即匿名函数. 示例如下: add = lambda x,y : x+ y add(1,2) # 结果为3 1.应用在函数式编 ...