#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. [ruby on rails] 跟我学之(7)创建数据

    通过form来创建数据,本章节将会涉及内容:创建form,用户重导向,渲染views 和 flash消息. 1. views初步 编辑 app/views/posts/index.html.erb这个 ...

  2. ssh: connect to host localhost port 22: Connection refused 问题

    错误原因:1.sshd 未安装2.sshd 未启动 3.防火墙 4需重新启动ssh 服务 解决方法:1.确定安装sshd: $ sudo apt-get install openssh-server ...

  3. Java 7 的7个新特性

    1.对集合类的语言支持:(??) 2.自动资源管理: 3.改进的通用实例创建类型推断:(??) 4.数字字面量下划线支持:(√) 5.switch中使用string:(√) 6.二进制字面量:(√) ...

  4. Backpack | & ||

    Backpack | Given n items with size Ai, an integer m denotes the size of a backpack. How full you can ...

  5. codeigniter load_class

    2014年7月7日 14:33:36 函数定义在 system/core/common.php中 使用方法是 load_class('Hooks', 'core'): 在core目录内寻找Hooks类 ...

  6. 3.前端笔记之JavaScript基础

    作者:刘耀 部分内容参考一下链接 参考: http://www.cnblogs.com/wupeiqi/articles/5369773.html http://javascript.ruanyife ...

  7. 基数排序(radix sort)

    #include<iostream> #include<ctime> #include <stdio.h> #include<cstring> #inc ...

  8. javaweb数据库操作

    本文主要内容有C3P0数据库连接池,dbutils的使用,元数据的应用 在对数据库进行增删改查时,使用数据库连接池可以有效的提高效率,节省资源,C3P0是Apache组织提供的一个有效方式 C3P0的 ...

  9. date +%s 能打印出自1970-01-01 00:00:00到当前时间的秒数

    [root@bass Desktop]# date +%s 1466561580 [root@bass Desktop]# python Python 2.6.6 (r266:84292, Jul 2 ...

  10. WMI

    https://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM#Windowsslavesfailt ...