题目链接:Codeforces 482A Diverse Permutation
题目大意:给定N和K,即有一个1~N的序列,现在要求找到一个排序,使得说所有的|pi?pi+1|的值有确定K种不同。
解题思路:构造,1,K+1,2,K,3,K-1,... K+2,K+3 ... N。
#include
#include
#include
using namespace std...
分类:
其他好文 时间:
2014-11-03 10:12:47
阅读次数:
153
不多说了,就是裸的模版题。
贴代码:
#include
#include
#include
#include
#include
#define N 30500
#define M 200000
#define inf 0x3f3f3f3f
using namespace std;
struct KSD
{
int v,len,next;
}e[M];
int head[N],cnt...
分类:
其他好文 时间:
2014-11-03 08:57:10
阅读次数:
184
设计器代码:namespace 大文件拷贝{ partial class Form1 { /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer compon...
//HeapOnly.cpp 只能在堆或者栈上分配内存的类 #include using namespace std; class HeapOnly { public: HeapOnly() { cout destroy(); ...
分类:
其他好文 时间:
2014-11-03 01:15:42
阅读次数:
203
#includeusing namespace std;typedef unsigned __int64 llong;llong mod_pro(llong x,llong y,llong n){llong ret=0,tmp=x%n;while(y){if(y&0x1)if((ret+=tmp)>...
分类:
编程语言 时间:
2014-11-02 23:58:42
阅读次数:
562
Nocomachns定理题目描述数学上已证明:任何一个自然数n的3次方可以表示为n个连续奇数之和,例如3的3次方为27=7+9+11。试编程求出,当键盘输入一个自然数时,求出它3次方的值及其连续奇数之和。输入一个整数N(N#include#includeusing namespace std;int...
分类:
系统相关 时间:
2014-11-02 23:47:10
阅读次数:
584
其实就是把一个十进制数转换成26进制,但是这个26进制数没有0,只有1-26:
两种处理方法:
#include
#include
#include
using namespace std;
const int radix = 26;
string getCol(int num) {
string res;
while (num != 0) {
res.push_bac...
分类:
其他好文 时间:
2014-11-02 22:39:25
阅读次数:
194
题意:问方程X^Z + Y^Z + XYZ = K (X1)有多少个正整数解 (K#include #include #include #include #include #define lll __int64using namespace std;#define N 200007lll k;int...
分类:
其他好文 时间:
2014-11-02 22:26:11
阅读次数:
195
#include #include #include using namespace std;char tbl[5] = {'S', 'H', 'C', 'D', 'J'};void shuffle(vector &card, vector &rnd) { int rlen= rnd.size...
分类:
系统相关 时间:
2014-11-02 22:21:00
阅读次数:
199
没事模拟模拟。。。
做模拟贵在不慌不乱、有条不紊的心境~
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int q[5050]; int n,pi;
long long words[5050]; long long a...
分类:
其他好文 时间:
2014-11-02 21:07:10
阅读次数:
208