#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. 获取oracle 表字段,表名,以及主键之类等等的信息。

    获取表名:  Oracle的user_talbes用于记录了用户表信息. select * from user_tables  获取某个表的字段: USER_TAB_COLS中记录了用户表的列信息.下 ...

  2. centos7 安装kvm, 并创建虚拟机

    # yum –y install qemu-kvm qemu-img bridge-utils # yum –y install libvirt virt-install virt-manager # ...

  3. 1.2 中国象棋将帅问题进一步讨论与扩展:如何用1个变量实现N重循环?[chinese chess]

    [题目] 假设在中国象棋中只剩下将帅两个棋子,国人都知道基本规则:将帅不能出九宫格,只能上下左右移动,不能斜向移动,同时将帅不能照面.问在这样条件下,所有可能将帅位置.要求在代码中只能使用一个字节存储 ...

  4. MFC基于Dialog的工程中使用OSG

    osg的例子有osgviewerMFC,是MDI类型的MFC工程,我一般用基于对话框的MFC较多. 注意观察MFC_OSG.h文件中的cOSG构造函数,参数是一个窗口句柄hWnd,这里的窗口可以不只局 ...

  5. php 正则表达式

    <?php //正则表达式 //定界符:斜杠:/正则/ //匹配开始:^ //匹配结束:$ /*\d代表一个数字 \w代表一个单词 */ $zz = "/(13[0-9]|14[5|7 ...

  6. java基础知识回顾之java Thread类学习(十二)-- 线程中断

    官方文档翻译: 如果本线程是处于阻塞状态:调用线程的wait(), wait(long)或wait(long, int)会让它进入等待(阻塞)状态,或者调用线程的join(), join(long), ...

  7. 10.组合模式(Composite Pattern)

    using System; using System.Collections.Generic; namespace ConsoleApplication8 { class Program { stat ...

  8. ytu 2011: C语言实验——找中间数(水题)

    2011: C语言实验——找中间数 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 212  Solved: 122[Submit][Status][Web ...

  9. mac平台下面nodejs环境搭配

    方法一(pkg方式:下载链接http://nodejs.org/dist/v0.12.4/node-v0.12.4.pkg): 官网:https://nodejs.org/download/ 例子: ...

  10. hdu 1757 矩阵快速幂 **

    一看正确率这么高,以为是水题可以爽一发,结果是没怎么用过的矩阵快速幂,233 题解链接:点我 #include<iostream> #include<cstring> ; us ...