topcoder SRM 592 DIV2 LittleElephantAndPermutationDiv2
#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的更多相关文章
- topcoder SRM 592 DIV2 LittleElephantAndBooks
#include <iostream> #include <vector> #include <algorithm> using namespace std; cl ...
- SRM 592 DIV2 报告
昨天下午查看邮箱,看到了topcoder的SRM比赛通知和cf的比赛通知,当时什么也不想做,心里空荡荡的,忽然就想参加一下,试试看.吃完晚饭回来一看,就剩十几分钟了,匆忙把平台下了,就开始等待比赛开始 ...
- Topcoder Srm 673 Div2 1000 BearPermutations2
\(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...
- Topcoder Srm 671 Div2 1000 BearDestroysDiv2
\(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...
- 求拓扑排序的数量,例题 topcoder srm 654 div2 500
周赛时遇到的一道比较有意思的题目: Problem Statement There are N rooms in Maki's new house. The rooms are number ...
- Topcoder srm 632 div2
脑洞太大,简单东西就是想复杂,活该一直DIV2; A:水,基本判断A[I]<=A[I-1],ANS++; B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列 我们枚 ...
- topcoder SRM 628 DIV2 BracketExpressions
先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> # ...
- topcoder SRM 628 DIV2 BishopMove
题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is ...
- Topcoder SRM 683 Div2 B
贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set&g ...
随机推荐
- 《OpenCV入门》(三)
这部分主要讲形态学的,回头把代码跑跑再来说下代码的感受:http://blog.csdn.net/poem_qianmo/article/details/24599073
- Ubuntu上安装gtk2.0不能安装的问题,“下列的软件包有不能满足的依赖关系”
zez@localhoss:~$ sudo apt-get install libgtk2.0-dev正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 ...
- bash read命令用法
read -p "Enter your student ID: " USERNAMEread -s -p "Enter your password: " PAS ...
- Product of Array Exclude Itself
Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WI ...
- asp.net文本编辑器FCKeditor使用方法详解
文本编辑器的使用: 1.FCKeditor的官方网站是:http://www.fckeditor.net/download 目前最新的FCKeditor.Net_2.6.9版本. 请在此页下载:ht ...
- CodeForces - 405C
Unusual Product Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Sub ...
- GCD的基本使用
// // ViewController.m // gcd队列与函数 // // Created by 诠释 on 15/9/3. // Copyright (c) 2015年 诠释. All rig ...
- 3.工厂方法模式(Factory Method)
using System; using System.Reflection; namespace ConsoleApplication1 { class Program { static void M ...
- 深入浅出TCP协议的三次握手过程
TCP是主机对主机层的传输控制协议,提供可靠的连接服务,采用三次握手确认建立一个连接: 每一次TCP连接都需要三个阶段:连接建立.数据传送和连接释放.“三次握手”就发生在连接建立阶段. 1.三次握手( ...
- js 实现文字列表滚动效果
今天要实现抽奖名单在首页滚动展示的效果,就用js写了一个,代码如下: html代码: <style type="text/css"> *{margin:;padding ...