本文以一段示例代码,说明使用boost asio进行同步通讯的使用方法。 #include?<iostream>
#include?<boost/asio.hpp>
using?namespace?std;
using?boost::asio::ip::tcp;?
int?main()
{
????boost::as...
分类:
其他好文 时间:
2015-06-15 01:48:51
阅读次数:
120
注意此处说的是重复的最长子串,只要出现重复就好,没说重复的次数。
下面给出的代码是编程珠玑中给出的一种实现。
他是通过后缀数组的方式实现的。
#include
#include
#include
using namespace std;
int comlen(char*p, char*q)//找出公共的最长子串
{
int i = 0;
if (p == NULL || q == NUL...
分类:
其他好文 时间:
2015-06-15 01:47:35
阅读次数:
218
hash原来做过
#include
#include
#include
using namespace std;
const int M = 1000001;
#define MIN -99999999
bool hashh[M];
void init()
{
for(int i=0;i<M;i++) hashh[i]=false;
}
int main()
{
int n,...
分类:
其他好文 时间:
2015-06-15 00:22:19
阅读次数:
142
题目:如题所示思路:逻辑运算,即二进制运算,无外乎与&、或|、非~、异或^以及移位>>,using namespace std;// recursive methodint add_1(int num1,int num2){ if(num1==0) return num2; ...
分类:
其他好文 时间:
2015-06-15 00:07:27
阅读次数:
166
题意:有不同等级的珍珠,价格不同,现在列出需要买的珍珠,求花的最少的钱(可以买高等级的来代替低等级的)
分析:dp[i]表示从最低等级到 i 等级花的最少的钱,dp[i]=min(dp[j]+v) v是从j+1到i全买i等级花的钱。需要三重循环。
代码:
#include
#include
#include
#define INF 1000000007
using namespace std...
分类:
其他好文 时间:
2015-06-14 22:53:08
阅读次数:
144
#include
#include
#include
using namespace std;
const int INF = 99999999;
int c[50005],w[10005];
int bag[10005];
int N,V,Z;
void _com_bag()
{
int i,j;
for(i=0;i<=Z;i++) bag[i]=INF;
bag[0]=...
分类:
其他好文 时间:
2015-06-14 22:50:29
阅读次数:
176
#include
#include
using namespace std;
struct rice{
int p;
int h;
}rice[505];
int max(int a,int b) {
return a>b?a:b;
}
int main()
{
int t,n,m,p,h,c,i,j,f[101],k;
cin>>t;
while(...
分类:
其他好文 时间:
2015-06-14 22:50:29
阅读次数:
256
using System;using System.Collections;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System...
分类:
其他好文 时间:
2015-06-14 22:42:55
阅读次数:
137
什么是冒泡排序?
冒泡排序是一种交换排序,所谓交换,就是将相邻元素两两比较,如果反序则进行交换从而使元素有序。之所以叫冒泡排序是因为,元素是从最后开始进行两两比较,将小的元素放到最上面的位置,看上去就跟气泡网上冒一样。
代码实现:
#include
#define MAXSIZE 10
using namespace std;
struct SqList {
int r[MAX...
分类:
编程语言 时间:
2015-06-14 21:30:27
阅读次数:
155
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Net;usin...
分类:
Web程序 时间:
2015-06-14 21:27:02
阅读次数:
304