207 条题解
- 
  0shislm LV 4 @ 2009-09-03 16:51:03 编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 秒杀吗?没有 
- 
  0@ 2009-08-28 17:40:20program noip03_pj; 
 var a:array[0..15]of longint;
 n,i,j:integer;
 begin
 read(n);
 fillchar(a,sizeof(a),0);
 a[0]:=1;
 for i:=1 to n do
 for j:=0 to i-1 do
 a[i]:=a[i]+a[j]*a;
 write(a[n]);
 end.
- 
  0@ 2009-08-27 13:37:10DP 
 f(i,j)=f(i,j-1)+f(i-1,j+1)
 就是进栈和出栈两种情况
- 
  0@ 2009-08-26 21:07:18MS,裸搜索 编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0msProgram P1122; 
 var i,j,n,m:longint;
 tot:int64;procedure search(i,j:longint); 
 begin
 if (i
- 
  0@ 2009-08-23 18:42:52program efr; 
 var x,l,n,w:longint;
 procedure zhao;
 begin
 if (x=0)and(l=0) then inc(w)
 else
 begin
 if x>0 then
 begin
 dec(x);
 inc(l);
 zhao;
 inc(x);
 dec(l);
 end;
 if (l>0) then
 begin
 dec(l);
 zhao;
 inc(l);
 end;
 end;
 end;
 begin
 readln(n);
 x:=n;
 l:=0;
 w:=0;
 zhao;
 write(w);
 end.
- 
  0@ 2009-08-22 16:40:34var f:array[1..500] of longint; 
 i,n:longint;
 begin
 readln(n);
 f[1]:=1;
 f[2]:=2;
 for i:=3 to n do
 f[i]:=(f-f)*3+f;
 writeln(f[n])
 end.
 很简单
- 
  0@ 2009-08-22 09:59:49编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0msvar x,l,n,w:longint; 
 procedure zhao;
 begin
 if (x=0)and(l=0) then inc(w)
 else
 begin
 if x>0 then
 begin
 dec(x);
 inc(l);
 zhao;
 inc(x);
 dec(l);
 end;
 if (l>0) then
 begin
 dec(l);
 zhao;
 inc(l);
 end;
 end;
 end;begin 
 readln(n);
 x:=n;
 l:=0;
 w:=0;
 zhao;
 write(w);
 end.
 搜索一次AC
- 
  0@ 2009-08-20 10:50:18#include using namespace std; long f[16]; int main() { int k; 
 scanf("%d",&k);
 f[0]=1;
 for (int i=1; i
- 
  0@ 2009-08-19 17:39:39各位大牛还在递推方程的混沌中?还在回溯穷举的泥潭里? 
 n个数的进出栈过程对应了一个01串——1代表进;0代表出;
 C(n,2n)-c(n+1,2n)OK了!!
- 
  0@ 2009-08-19 14:46:42编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0ms
 卡特兰数!
- 
  0@ 2009-08-18 16:32:06type 
 integer=longint;var 
 n,k:integer;procedure doit(x,y:integer); 
 var i,j:integer;
 begin
 if (x=0) and (y=0) then
 inc(k)
 else
 begin
 if x>0 then doit(x-1,y+1);
 if y>0 then doit(x,y-1);
 end;end; begin 
 k:=0;
 read(n);
 doit(n,0);write(k); 
 end.
- 
  0@ 2009-08-15 21:41:37if (i>0) and (j=0) then y:=y; 
 if (i>0) and (j>0) then y:=y+y;
 if (i=0) and (j>0) then y:=y;
 动归方程
- 
  0@ 2009-08-14 15:21:41卡特兰数咯... 
- 
  0@ 2009-08-13 09:34:01编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0ms
- 
  0@ 2009-08-11 17:49:46比较笨,直接搜索了,参考各位大牛的各种神奇方法………… 
- 
  0@ 2009-08-10 23:43:12令f表示栈外有i个元素还未进栈且栈内有j个元素,那么以进栈还是出栈为决策就马上得到了转移方程f=f+f。 
- 
  0@ 2009-08-10 07:27:40编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0msprogram p1122; 
 var a,i,j,k,l,n,m:longint;
 tot:qword;
 procedure find(x,y:integer); {x记录的是栈中元素的个数,y记录的是操作过的元素的个数}
 begin
 if y=n+1 then begin inc(tot); exit; end; {已经操作过所有的元素了则方法数加一,退出}
 if x>0 then find(x-1,y); {如果栈中有元素则弹出}
 find(x+1,y+1); {将下一个元素压入栈中}
 end;
 begin
 readln(n);
 find(0,1); {将1压入栈中}
 writeln(tot);
 end.
 楼下你的 l 是什么东西?
- 
  0@ 2009-08-06 17:52:18编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0ms
 program su_he(input,output);
 var
 total,n:longint;
 procedure research(tp,l,r:longint);
 begin
 if r=n+1 then begin total:=total+1; exit; end;
 if tp0 then research(tp-1,l+1,r);
 research(tp+1,l,r+1);
 end;
 begin
 readln(n);
 total:=0;
 research(0,0,1);
 writeln(total);
 readln;
 end.用回溯法做,程序很短,但比较难理解。15以内的都可以过。16就会超时。 
- 
  0@ 2009-08-04 15:20:16编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0ms
 var
 a:array[-1..5000] of int64;
 i,j,n:longint;
 begin
 read(n);
 a[0]:=1;a[1]:=1;
 for i:=2 to n do
 for j:=1 to i do
 a[i]:=a[i]+a[j-1]*a;
 write(a[n]);
 end.
 用乘法原理做~~~~~
- 
  0@ 2009-07-29 20:31:01编译通过... 
 ├ 测试数据 01:答案正确... 0ms
 ├ 测试数据 02:答案正确... 0ms
 ├ 测试数据 03:答案正确... 0ms
 ├ 测试数据 04:答案正确... 0ms
 ├ 测试数据 05:答案正确... 0ms
 ├ 测试数据 06:答案正确... 0ms
 ├ 测试数据 07:答案正确... 0ms
 ├ 测试数据 08:答案正确... 0ms
 ├ 测试数据 09:答案正确... 0ms
 ├ 测试数据 10:答案正确... 0ms
 ---|---|---|---|---|---|---|---|-
 Accepted 有效得分:100 有效耗时:0ms
 #include
 using namespace std;
 int c(int a,int b)
 {int i,s=1;
 for(i=1;i>n;
 cout