- 博客(8)
- 收藏
- 关注
原创 大牛教你写代码
<br />如何提高ACM竞赛编写代码的速度摘自上海交大bbs:奋是基础,一切的前提奋之上是忍耐大部分时候大部分人的“习惯”都是跟“效率”作对的奋让你有机会去跟这些习惯做斗争在 ACM 竞赛的级别,写代码不是在解题,而是实现早已在脑子里准备好的一个逻辑流程。这个追求跟大部分没有训练过的人的习惯相反,要扭转这种习惯,第一步可以做尝试有:1. 把准备和敲键盘分割为两个动作。2. 把敲键盘和运行分割为两个动作。3. 编译错误这件事情几乎总是会发生,但“尝试”减少编译错误的过
2011-05-27 01:54:00 429
原创 第二次排位赛
<br />第一题http://202.197.224.59/OnlineJudge2/index.php/Problem/index/p/6/<br />简单DFS,DP也可以做^<br />#include<iostream>using namespace std;char s[20];int dp[20][20];int main(){ int i,j; while(cin>>s) { //puts(s); mems
2011-05-10 15:56:00 265
原创 HDOJ 2553 N皇后问题
<br />http://acm.hdu.edu.cn/showproblem.php?pid=2553<br />不打表 果断超时!!<br />#include<iostream>using namespace std;int n,sum;int right0[22],left0[22],row0[22];int dfs(int i){ int j,rm,lm; rm=i; lm=n-i; for(j=0;j<n;j++,rm++,lm+
2011-04-24 13:38:00 338
原创 连通图
<br />#include<iostream>struct arcnode{ int nextv; arcnode *nextarc; arcnode(int v0=0,arcnode *n=NULL){nextv=v0;nextarc=n;}};struct vnode{ int a; arcnode *firstarc; vnode(int v0=0,arcnode *n=NULL){a=v0;firstarc=n;}}adv
2011-04-22 16:04:00 314
原创 AOE网的关键活动
<br /> #include<iostream>using namespace std;struct node{ int f,l,w;}e[100];int main(){ int n,m,k,i,j; int f[100]; cin>>n; while(n--) { int v1[100]={0}; int v2[100]={0}; cin>>m>>k;
2011-04-22 16:02:00 411
原创 背包问题
<br />http://cie.xtu.edu.cn/exam/index.php/problem/read/id/1012<br />#include<iostream>using namespace std;bool Knap(int s,int n,int a[]){ if(s==0)return true; else if(s<0||n<1)return false; else if(Knap(s-a[n],n-1,a)==true)return true
2011-04-22 16:00:00 256
原创 重构二叉树
<br />http://cie.xtu.edu.cn/exam/index.php/problem/read/id/1005<br />#include<iostream>using namespace std;struct node{ int t; char s; node *right; node *left;};node *ints(char s,int a[]){ node *p=new node; p->s=s;
2011-04-22 15:47:00 359
原创 遍历二叉树
<br /> #include<iostream>using namespace std;struct node{ char z; node *left; node *right; node(char z0='#',node *left0=NULL,node *right0=NULL) :z(z0),left(left0),right(right0){} }p[100];void b(node *p,int a){
2011-04-22 15:39:00 193
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人