| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 773 人关注过本帖
标题:[讨论]ZJU2284何解
只看楼主 加入收藏
leeco
Rank: 4
等 级:贵宾
威 望:10
帖 子:1029
专家分:177
注 册:2007-5-10
结帖率:50%
收藏
 问题点数:0 回复次数:5 
搜索更多相关主题的帖子: php acm problem pid 
2007-05-16 16:26
I喜欢c
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:64
帖 子:1749
专家分:0
注 册:2007-3-2
收藏
得分:0 
哪有什么ZJU2284

 我是指针,却丢失了目标地址!          我是循环,却缺少了结束条件!      我是函数,却没有人来调用!   
2007-05-16 17:40
PcrazyC
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:5652
专家分:0
注 册:2006-10-20
收藏
得分:0 
他是问你题目怎么做

雁无留踪之意,水无取影之心
2007-05-16 17:42
PcrazyC
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:5652
专家分:0
注 册:2006-10-20
收藏
得分:0 
ZJU是浙江大学zhejiang university

2284是题目代号

雁无留踪之意,水无取影之心
2007-05-16 17:44
I喜欢c
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:64
帖 子:1749
专家分:0
注 册:2007-3-2
收藏
得分:0 

Inversion Number

--------------------------------------------------------------------------------

Time limit: 1 Seconds Memory limit: 32768K
Total Submit: 842 Accepted Submit: 335

--------------------------------------------------------------------------------

Let { A1,A2,...,An } be a permutation of the set{ 1,2,..., n}. The inversion number of the permutation is the number of integer pairs (i,j) that satisfy 1<=i<j<=n and Ai>Aj.

Your task is to calculate how many n-permutations has an inversion number of k.


Input

The input consists of several test cases. Each test case contains two integers n(0<n<=20) and k(0<=k<=200), which are mentioned above. Input is terminated by n=m=0, which should not be proceeded.

Output

For each case of input output the number of n-permutations that has an inversion number of k in one line.

Sample Input

2 0
5 3
0 0

Sample Output

1
15


没怎么看懂题


 我是指针,却丢失了目标地址!          我是循环,却缺少了结束条件!      我是函数,却没有人来调用!   
2007-05-16 17:53
leeco
Rank: 4
等 级:贵宾
威 望:10
帖 子:1029
专家分:177
注 册:2007-5-10
收藏
得分:0 
题目的大意是令 A1,A2,...,An为集合{ 1,2,..., n}的一个排列,这个排列的逆序数是满足1<=i<j<=n且Ai>Aj的整数对(i,j)的个数。
你的任务是计算逆序数为k的{ 1,2,..., n}的排列的个数。

例如

n=2,k=0时,这样的排列有1个
n=5,k=3时,这样的排列有15个
2007-05-16 18:48
快速回复:[讨论]ZJU2284何解
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.053830 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved