#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#define LL long long using namespace std; class LittleElephantAndPermutationDiv2{
public:
LL getNumber(int N, int k){
LL res = ;
vector<int> a(N);
for(int i = ; i < N; ++ i ){
a[i] = i + ;
}
do{
LL value = ;
for(int i = ; i < N; ++ i){
value += max(a[i],i+);
}
if( value >= k ) ++res;
copy(a.begin(),a.end(),ostream_iterator<int>(cout," "));
cout<<endl;
}while(next_permutation(a.begin(),a.end()));
cout<<res<<endl;
for(int i = ; i<= N; ++ i) res *= i;
return res;
}
};

topcoder SRM 592 DIV2 LittleElephantAndPermutationDiv2的更多相关文章

  1. topcoder SRM 592 DIV2 LittleElephantAndBooks

    #include <iostream> #include <vector> #include <algorithm> using namespace std; cl ...

  2. SRM 592 DIV2 报告

    昨天下午查看邮箱,看到了topcoder的SRM比赛通知和cf的比赛通知,当时什么也不想做,心里空荡荡的,忽然就想参加一下,试试看.吃完晚饭回来一看,就剩十几分钟了,匆忙把平台下了,就开始等待比赛开始 ...

  3. Topcoder Srm 673 Div2 1000 BearPermutations2

    \(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...

  4. Topcoder Srm 671 Div2 1000 BearDestroysDiv2

    \(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...

  5. 求拓扑排序的数量,例题 topcoder srm 654 div2 500

    周赛时遇到的一道比较有意思的题目: Problem Statement      There are N rooms in Maki's new house. The rooms are number ...

  6. Topcoder srm 632 div2

    脑洞太大,简单东西就是想复杂,活该一直DIV2; A:水,基本判断A[I]<=A[I-1],ANS++; B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列 我们枚 ...

  7. topcoder SRM 628 DIV2 BracketExpressions

    先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> # ...

  8. topcoder SRM 628 DIV2 BishopMove

    题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is ...

  9. Topcoder SRM 683 Div2 B

    贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set&g ...

随机推荐

  1. tomcat配置文件之Server.xml

    Server.xml包含的元素有<Server>.<Service>.<Connector>.<Engine>.<Host>.<Con ...

  2. Java修改数组长度

    java中没有关于修改数组长度的api,在此本人提供了修改数组长度的两个函数:arrayAddLength()和arrayReduceLength().详细见代码.  [java] view plai ...

  3. 自动化运维之puppet的学习(如何找到你需要的模块)

    https://forge.puppetlabs.com/  puppet 模块下载 http://kisspuppet.com/2014/01/14/puppet_forge_modules/ pu ...

  4. linux 回收站的添加

    在~下     .bashrc或者.bash_profile加入 mkdir -p ~/.trash     alias rm=trash       trash()     {      mv $@ ...

  5. Linux 查看网络连接状态

    CLOSED:无连接是活动的或正在进行ESTABLISED:已建立连线的状态:SYN_SENT:发出主动连线 (SYN 标志) 的连线封包:SYN_RECV:接收到一个要求连线的主动连线封包:FIN_ ...

  6. MySQL之扩展(触发器,存储过程等)

    视图 视图是一个虚拟表(非真实存在),其本质是[根据SQL语句获取动态的数据集,并为其命名],用户使用时只需使用[名称]即可获取结果集,并可以将其当作表来使用. SELECT * FROM ( SEL ...

  7. 【Hibernate】Hibernate系列8之管理session

    管理session 更简单的,注入对象:

  8. JavaScript常用事件

    一般事件 事件 浏览器支持 描述 onClick HTML: 2 | 3 | 3.2 | 4   Browser: IE3 | N2 | O3 鼠标点击事件,多用在某个对象控制的范围内的鼠标点击 on ...

  9. 如何在android的mk文件添加依赖已经编译好的库

    用$(MY_LIB)是代表你的库的所在目录,目录结构是这样 MY_LIB |---include |-----xxx.h |-----xxx.h |---lib |----MYLIB.a LOCAL_ ...

  10. php中GD库的简单使用

    在php中需要图像处理的地方GD库会发挥重要的作用,php可以创建并处理包括GIF,PNG,JPEG,WBMP以及XPM在内的多种图像格式,简单的举几个例子: 1.用GD库会创建一块空白图片,然后绘制 ...