点击打开链接
求MST的最长边~
prim
#include
#include
#include
#include
#define Min(a,b) (a)<(b)?(a):(b)
using namespace std;
const int INF = 1000000000;
const int maxn = 2000 + 5;
struct pto
{...
分类:
其他好文 时间:
2014-06-11 06:45:17
阅读次数:
235
非常巧妙的题目,巧用cmp,注意cmp的重载
#include
#include
using namespace std;
string a[55];
bool cmp(string a, string b){
return a+b > b+a;
}
int main(int argc, char const *argv[])
{
int n;
while(cin >...
分类:
其他好文 时间:
2014-06-11 06:10:28
阅读次数:
293
看到const关键字,C++程序员首先想到的可能是const常量。这可不是良好的条件反射。如果只知道用const定义常量,那么相当于把火药仅用于制作鞭炮。const更大的魅力是它可以修饰函数的参数、返回值,甚至函数的定义体。const是constant的缩写,“恒定不变”的意思。被const修饰的东西都受到强制保护,可以预防意外的变动,能提高程序的健壮性和高效性。所以很多C++程序设计书籍建议:“...
分类:
编程语言 时间:
2014-06-11 06:00:43
阅读次数:
331
vector split(const string& src, const
string& separator){vectordest;string str = src;string
substring;string::size_type start = 0, index;do{index = st...
分类:
其他好文 时间:
2014-06-10 20:35:36
阅读次数:
238
题目来源:Light 1289 LCM from 1 to n
题意:。。
思路:从1到n 打过某个数是以一个素数的几次方 那么答案就乘以这个素数
主要是筛选素数 存不下 位优化 一个整数32位标记32个数 内存缩小32倍
是学习别人的
#include
#include
#include
#include
using namespace std;
const int maxn ...
分类:
其他好文 时间:
2014-06-10 18:05:45
阅读次数:
250
结构体: 关系密切但数据类型不尽相同,常指针和常量指针的区别:char * const cp
: 定义一个指向字符的指针常数,即const指针,常指针。const char* p : 定义一个指向字符常数的指针,即常量指针。char const* p :
等同于const char* p[2]。理解...
分类:
编程语言 时间:
2014-06-10 11:34:12
阅读次数:
235
【题目描述】回文数是指从左向右念和从右向左念都一样的数。如12321就是一个典型的回文数。给定一个进制B(2 2 #include 3 #include 4
#include 5 #include 6 const int maxl=1000; 7 using namespace std; 8...
分类:
其他好文 时间:
2014-06-10 08:49:27
阅读次数:
180
题意:求在可以一秒沿着既定方向走1到3步和向左或右转90度的情况下,从起点到终点的最短时间
思路:坑的是这机器人还有体积,所以不能走到边界,然后就是单纯的BFS
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 110;
struct node {
int x,y;...
分类:
其他好文 时间:
2014-06-10 07:59:51
阅读次数:
256
Hans Rosling是卡罗琳学院的国际卫生学教授,这位学者与众不同的技能是数据可视化,以直观的数据展现了令人信服的世界观,并且在gapminder.org提供无偿展示以及下载。如果你没有看过以下的TED讲座,真心建议你花点时间,保证物有所值:
Hans Rosling: Asia’s rise — how and whenHans Rosling: Let my dataset ch...
分类:
其他好文 时间:
2014-06-10 06:21:50
阅读次数:
336
C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。一、Const作用如下表所示:N.....
分类:
其他好文 时间:
2014-06-09 16:42:38
阅读次数:
330