10
21
2013
0

【BZOJ1800】【Ahoi2009】fly 飞行棋【暴力】

看起来很神,看到数据范围就呵呵了。

program p1800;
	var
		x:array[1..4] of longint;
		d:array[1..20,1..20] of int64;
		i,j,n,tot:longint;
	procedure dfs(k1,k2:longint);
		var
			i,j:longint;
		begin
			if k2>4 then begin
				if (d[x[1],x[2]]=d[x[3],x[4]]) and (d[x[2],x[3]]=d[x[4],x[1]]) then
					inc(tot);
				exit;
			end;
			for i:=k1 to n do begin
				x[k2]:=i;
				dfs(i+1,k2+1);
			end;
		end;
	begin
		readln(n);
		for i:=1 to n do
			read(d[i,i mod n+1]);
		for i:=1 to n do begin
			j:=(i+1) mod n+1;
			while j<>i do begin
				d[i,j]:=d[i,(j-2+n) mod n+1]+d[(j-2+n) mod n+1,j];
				j:=j mod n+1;
			end;
		end;
		tot:=0;
		dfs(1,1);
		writeln(tot);
	end.
Category: 未分类 | Tags:
8
31
2013
0

【BZOJ1192】【HNOI2006】鬼谷子的钱袋【水题】

program p1192;
	var
		i,j,n:int64;
	begin
		readln(n);
		j:=0;
		while n>0 do begin
			inc(j);
			n:=n div 2;
		end;
		writeln(j);
	end.
Category: 未分类 | Tags:

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com