int setsockopt(SOCKET s,int level,int optname,const char* optval,int optlen);s(套接字): 指向一个打开的套接口描写叙述字level:(级别): 指定选项代码的类型。SOL_SOCKET: 基本套接口IPPROTO_IP:...
分类:
其他好文 时间:
2014-06-19 06:37:51
阅读次数:
259
http://poj.org/problem?id=3254 1 #include 2 #include 3 #include 4 #define maxn 1000 5 using namespace std; 6 const int mod= 100000000; 7 8 int dp[...
分类:
其他好文 时间:
2014-06-18 23:48:54
阅读次数:
374
#import
int main(int argc, const char * argv[])
{
// int a[2][3]={
// {1,2,3},
// {4,5,6}
// };
// int a[2][3]={1,2,3,4,5,6};
// //打印单个元素
// printf("%d",a[1][1]);
// ...
分类:
编程语言 时间:
2014-06-16 23:05:14
阅读次数:
395
继续校赛前的建图任务,当时只写了DFS遍历,今天把BFS也写了一下。
#include
#include
#include
#include
#include
const int maxe = 10001;
using namespace std;
struct node{
int to,w;
node *next;
}*head[maxe];//he...
分类:
其他好文 时间:
2014-06-16 22:25:20
阅读次数:
286
很经典的题目,而且是标准的线段树增加lazy标志的入门题目。
做了好久线段树,果然是practice makes perfect, 这次很畅快,打完一次性AC了。
标志的线段树函数。
主要是:
更新的时候只更新到需要的节点,然后最后的时候一次性把所以节点都更新完毕。
这也是线段树常用的技术。
#include
const int SIZE = 100005;
struct Node...
分类:
其他好文 时间:
2014-06-16 20:38:39
阅读次数:
182
(一)
一定要避免传递一些references去指向其实并不存在的对象。
看下面这个类:
class Rational {
public:
Rational(int numerator = 0, int denominator = 1);
private:
int n, d;
friend const Rational operator*(const Rat...
分类:
编程语言 时间:
2014-06-16 19:09:14
阅读次数:
269
int b = 0;
int c = 0;
int main(int argc, const char *argv[])
{
printf("%d %d %d %d %d",b,b++,b,++b,b);
printf("%d %d %d %d %d",c,++c,c,c++,c);
return 0;
}
结果为 2 1 1 1 0 2 2 1 0 0
这个可以理解,因为p...
分类:
其他好文 时间:
2014-06-16 18:44:35
阅读次数:
170
本篇博文作为系列博文的第一篇,主要讲解一些opencv的基本操作,包括读取、写回、访问像素、修改像素、显示照片。
读取照片
所用函数:Mat
imread(const string& filename, int flags) (C++ function)
其中:filename为文件名,flags代表读取方式,默认情况下读取通道为3,当设置为...
分类:
其他好文 时间:
2014-06-16 14:48:14
阅读次数:
235
write 函数:调用write函数可以从打开的文件中写数据。原型:#include ssize_t write(int filedes, const void* buf, size_t nbytes);返回值:若成功则返回读写入的字节数,返回值要与nbytes相同。如果返回值与nbytes不相同,...
分类:
其他好文 时间:
2014-06-15 13:43:40
阅读次数:
220
在OpenCV中,threshold用来进行对图像(二维数组)的二值化阈值处理通过查找OpenCV在线文档,发现存在很多函数:其函数原型如下:1. C版本的:函数原型:void cvThreshold( const CvArr* src,CvArr* dst, double threshold,do...
分类:
其他好文 时间:
2014-06-15 13:09:45
阅读次数:
198