题目大意:找到队列中不符合非升(降)序趋势的编号个数,分别判断升序跟降序的个数,最后取最小。#include
#include
#include
#include
using namespace std;#define maxn 30005int n;
int cow[maxn];
int f[maxn][5];int...
分类:
其他好文 时间:
2015-04-15 19:37:54
阅读次数:
131
using System;using System.Threading;using System.Runtime.Remoting.Messaging;using System.Collections.Generic;namespace PurchaseSystem.Component{ pu...
题目描述:已知一个无向带权图,求最小整数k。使仅使用权值小于等于k的边,节点1可以与节点n连通。输入:输入包含多组测试用例,每组测试用例的开头为一个整数n(1 2 #include 3 #include 4 #include 5 using namespace std; 6 7 stru...
分类:
其他好文 时间:
2015-04-15 19:08:52
阅读次数:
104
VS2012 输入代码执行后屏幕一闪而过不出现显示框:#include int main (){ using namespace std; const int ArSize = 20; char name[ArSize]; char dessert[ArSize]; cout int main ()...
分类:
编程语言 时间:
2015-04-15 19:04:26
阅读次数:
395
在考试代码的基础上稍微改改就a了……当时为什么不稍微多想想……插入/删除一个新节点时就把其dfn插入set。当前的答案就是dfn上相邻的两两节点的距离和,再加上首尾节点的距离。比较显然?不会证明……貌似叫“虚树”?#include#includeusing namespace std;#define...
分类:
其他好文 时间:
2015-04-15 18:48:02
阅读次数:
106
#include "stdafx.h"#include using namespace std;templateclass Cat{public: void eat() { printf("eat %s",typeid(T).name()); }};class Fis...
分类:
编程语言 时间:
2015-04-15 18:31:16
阅读次数:
142
描述图的邻接矩阵(Adjacency Matrix)表示是采用二维数组的方式。通过邻接矩阵可以立刻看出两顶点之间是否存在一条边,只需要检查邻接矩阵重行i和列j是否是非零值。对于无向图,邻接矩阵是对称的。下图是摘自《算法:C语言实现》
代码实现#include
using namespace std;
const int VERTEX_NUM = 20; // 顶点的最...
分类:
其他好文 时间:
2015-04-15 17:15:47
阅读次数:
160
题意:
给p,b,n求最小的l使b^l==n(mod p)。
题意:
相当于在0~p-1内搜索l满足同余式,baby_step,giant_step相当于分块的二分搜索,设m=sqrt(p), 则将p分为m*m,在m块内每块进行m个数的二分搜索。
代码://poj 2417
//sep9
#include
#include
#include
using namespace std;
...
分类:
编程语言 时间:
2015-04-15 17:11:42
阅读次数:
174
【项目5-友元类】
定义下面两个类的成员函数(为体验友元类,实际上本例并不一定是一个好的设计,
将两个类的合并为一个DateTime,日期、时间都处理更好)
/*
*Copyright (c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*dood luck
*文件名称:d.cpp
*作 者:张旺华
*完成日期:2015年4月15日
...
分类:
其他好文 时间:
2015-04-15 17:07:25
阅读次数:
184
#include
#include
#include
#include
#include
using namespace std;
#define maxn 100000
int n, m, x[maxn];
int Max;
bool judge(int d)
{
int cnt = 1;
int a = x[0];
for(int i=1; i<n; i...
分类:
其他好文 时间:
2015-04-15 17:03:27
阅读次数:
120