- 博客(37)
- 资源 (4)
- 收藏
- 关注
转载 c++and c read test
#include #include #include #include #include #include using namespace std;template double benchmark(Func f, size_t iteration) {f();timeval a,b;gettimeofday(&a, 0);for (;
2013-11-30 12:07:06 723
原创 The shortest path-dp+tsp
#include #include using namespace std;#define inf 0x7fffffffstruct node { double x,y;};double map[220][220],dp[220][220];double cal(node a,node b){ double x=a.x-b
2013-11-28 19:52:40 677
原创 String Problem-kmp+最小表示法
#include using namespace std;char a[1000010];int nex[1000010];void nexts(){ int i=0,j=-1,k=strlen(a); nex[0]=-1; while (i if (j==-1||a[i]==a[j]) {
2013-11-28 19:51:23 575
原创 Sorting by Swapping
#include using namespace::std;int main(){int m,n,i,lab,a[10000]={0},b[10000]={0};cin >> m;while(m--){cin >> n;for(i=1;i{cin >> a[i];b[a[i]]=i;}lab=0;for(i=1;i{i
2013-11-28 19:50:40 888
原创 Smallest Difference-模拟
#include using namespace std;int main(){ int t; scanf("%d\n",&t); while (t--) { char a[20]; gets(a); int i,j,flag=15,len=0,k=strlen(a),b[20]={0},m
2013-11-28 19:49:46 742
原创 Number Transformation-bfs+素数筛选法
#include #include using namespace std;struct node { int v,cnt; node() { v=0;cnt=0; }};int n,m,pri[1005],v[1005];int bfs(int s){ memset(v, 0, size
2013-11-28 19:48:12 617
原创 Normalized Form-二叉树
#include #include using namespace std;char a[34000];bool cal(int &i,int m){ int n=m; for (++i; a[i]; i++) { if (a[i]=='(') { if (m) n&=cal(i,
2013-11-28 19:47:28 1047
原创 Missing Numbers-位运算
#include #include #include int main() { __int64 i,n,num,n1,n2,j,s1,s2,max; char ch; while(1) { scanf("%I64d",&n); if(n==0) break; s1=0;
2013-11-28 19:45:55 893
原创 MatrixPowers-矩阵连乘
#include using namespace std;#define N 105#define FF(i,n) for(i=0;iint ans[N][N];int init[N][N];int buf[N][N];void matrixMul(int a[][N],int b[][N],int n,int mod){int i,j,k;FF(i,n)FF(
2013-11-28 19:44:58 651
原创 Longge's problem-数论
#include #include #include using namespace std;__int64 cal(__int64 m){__int64 i=m,k=sqrt(m),flag=m;for(i=2;iif(m%i==0)flag=flag/i*(i-1);while(m%i==0)m/=i;}if(m!=1)fla
2013-11-28 19:44:16 562
原创 Intervals-bellman-ford+差分约束
#include using namespace std;const int inf=0x2fffffff;struct node { int s,t,w;}edge[50010];int main(){ int n; while (~scanf("%d",&n)) { int i,j,flag,x=i
2013-11-28 19:43:21 558
原创 How many-字典树+最小表示法
#include using namespace std;struct node { node *next[2]; node(){ next[0]=next[1]=NULL; }};char str[10010][110];int mins(char a[]){ int i=0,j
2013-11-28 19:42:02 608
原创 How many ways-dp
#include using namespace std;int n,m,a[101][101],dp[101][101];int main(){ int t; scanf("%d",&t); while (t--) { int i,j,i1,j1; scanf("%d%d",&n,&m);
2013-11-28 19:41:25 509
原创 Hidden Password-最小表示法
#include using namespace std;int mins(char s[],int len){ int i=0,j=1,k=0,t; while (i t=s[(i+k)%len]-s[(j+k)%len]; if (!t) k++; else {
2013-11-28 19:40:39 523
原创 Glass Beads-最小表示法
#include #include #include using namespace std;int mins(char s[]){ int i=0,j=1,t,k=0,len=strlen(s); while (i t=s[(i+k)%len]-s[(j+k)%len]; if (!t)
2013-11-28 19:39:46 647
原创 find the longest of the shortest-spfa删边
#include #include using namespace std;const int inf=0x2fffffff;#define N 1005struct node { int v,w,next; node() { v=w=next=0; }}e[N*N];int n,m,cnt,dis
2013-11-28 19:38:45 527
原创 Cleaning Robot-dfs+bfs+tsp
#include #include using namespace std;struct node { int x,y,step; node() { x=y=step=0; }};int n,m,len,ans,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1},d[30][30];ch
2013-11-28 19:37:24 792
原创 Is- dp求正则表达式
#include using namespace std;int main(){ char a[101],b[101]; int n; scanf("%s",a); scanf("%d",&n); while (n--) { scanf("%s",b); int i,j,k,l1=strl
2013-11-23 19:29:10 621
原创 Compromise-dp加标记路径
#include #include #include using namespace std;int dp[110][110],mark[110][110],loc[110],cnt;char a[110][40],b[110][40];void print(int i, int j){ if (i==0||j==0) retur
2013-11-23 13:19:03 599
原创 一个人的旅行--spfa
#include #include using namespace std;const int inf=0x3fffffff;int map[1010][1010],dis[1010],v[1010];int main(){ int n,m,k; while (~scanf("%d%d%d",&n,&m,&k)) { int
2013-11-23 13:16:17 622
原创 位图
#include #include using namespace::std;int main(){ int i,j,x,y,k,flag=1,b[182][182]={0}; char a[182][182]; scanf("%d%d",&x,&y); for(i=0;i for(j=0;j
2013-11-23 13:14:51 721
原创 梁山好汉排座次
#include #include using namespace std;int main(){ int n,r[200];//r表示每个点的入度 string name,s[200]; bool a[200][200],vis[200];//a邻接矩阵,vis在排序时纪录这个点是否已经确定顺序 while (cin >> n&
2013-11-23 13:14:02 2983
原创 合并果子
#include #include using namespace std;typedef struct node{ int data; friend bool operator { return a.data > b.data; } }Point;int main(){
2013-11-23 13:12:34 659
原创 比武大会
#include using namespace std;int mark[300];typedef struct { int l,r,v,cnt;}node;node a[300],b[300];int cmp(node x,node y) { return x.v}int main() {
2013-11-23 13:11:19 1140
原创 分词时发现的小技巧
昨儿在公司做分词系统修改的工作时,偶然发现了printf()原来可以高效的进行汉字输出,可能我的表达能力有问题,下面用代码描述:#include using namespace std;int main(int argc, char *argv[]) {char a[] = "abcdefghijklmnopqrstuvwxyz";printf("%.*
2013-11-23 13:10:28 550
原创 find the longest of the shortest --spfa删边
#include #include using namespace std;const int inf=0x2fffffff;#define N 1005struct node { int v,w,next; node() { v=w=next=0; }}e[N*N];int n,m,cnt,dis
2013-11-16 22:59:22 676
原创 Faculty Dividing Powers--数论
#include #include using namespace std;#define N 1200005#define inf ~0U>>1#define LL __int64int a[6000000],p[N];LL cal(LL n,LL k){ LL sum=0; while(n>=1) {
2013-11-16 22:57:01 701
原创 Compromise--dp加标记路径
#include #include #include using namespace std;int dp[110][110],mark[110][110],loc[110],cnt;char a[110][40],b[110][40];void print(int i, int j){ if (i==0||j==0) retur
2013-11-16 22:55:36 821
原创 A Knight and a Queen - bfs+map+pair
#include #include #include using namespace std;struct node { int x,y,step; node () { x=y=step=0; }};int n,m,sx,sy,tx,ty,flag;int dx[8]={-1,-2,-2,-1,1,
2013-11-16 22:52:41 1223
原创 c语言的bnf总结
注:不能说是自己的原创,只能说自己是总结了下而已translation_unit : external_decl | translation_unit external_decl ;external_decl : function_definition | decl ;function_definition : decl_specs declarator decl_list
2013-11-16 22:48:06 3627 1
原创 c++ offset define
#include using namespace std;class test {public:void show() {cout }public:int x = 10;int y = 20;};#define offset_(x, yy) ((size_t)&((x *)nullptr)->y)int main(
2013-11-14 22:43:49 1571
原创 机器人M号
#include using namespace std;int qmod(int a,int k){ if (k==1) return a%10000; int t=qmod(a, k/2); t=t*t%10000; if (k%2) t=t*a%10000; return t;}
2013-11-13 20:31:43 1052
原创 哥德巴赫猜想
#include #include unsigned i,j,k,n,r;bool a[16777216];void prime(){ for (i=3; i a[i]=1; for(i=3;i if (a[i]) for (j=i*i; j a[j]=0;}
2013-11-13 20:30:29 991
原创 岛上的植物
#include #include using namespace std;int lenp,leno,map[101][101],v[101][101];int n,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1},ap[1000];bool cal(int m){ if (m==1) return 0
2013-11-13 20:24:39 814
原创 xor
#include int main(){ int n; while (scanf("%d",&n)!=EOF) { __int64 i,j,a[100010],sum1[21],ans=0; memset(a, 0, sizeof(a)); memset(sum1, 0, sizeof(sum1));
2013-11-13 20:23:35 725
原创 工作笔记
调试笔记:debug模式下:c:打印进程p+空格+对象:打印出地址po+空格+对象:打印内容[]+$ 一个或者多个空格,后面仅跟着回车键ll命令可以显示所有文件****************************9.21****************************mate+空格+
2013-11-13 20:22:03 1341
转载 [转]简单分析C之Curl模块同php的curl和python的pycurl模块的关系
原文地址:http://www.cnblogs.com/CLTANG/archive/2012/03/25/curl_php_python.html缘起:以前一直喜欢用scrapy做爬虫,并且实践效果也很好,后来由于单位让自己写一套分布式爬虫(python实现),替代公司原有的爬虫(php实现),大致用于实践后,发现效果是比原来的效果好,原来能做配置的网站20个里能配置10个,现在20
2013-11-13 20:14:27 1261
CTU Open Contest 2009
2010-10-29
2008 ACM ICPC South Central USA Regional Programming Contest
2010-10-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人