vj1354 Hanoi双塔问题

Vj1354 - 2*2^(n-1 const maxb=7 base=1000000000 var n,len:integer ans:array[0.maxb of longint procedure main var i,j:integer begin readln(n len:=1

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//±ÉÈ˵ķ½·¨ //¸ß¾« //´ð°¸Îªµ¥ËþµÄÁ½±¶ ¼´ 2*2^(n-1) / const maxb=7; base=1000000000; var n,len:integer; ans:array[0. .maxb] of longint; procedure main; var i,j:integer; begin readln(n); len:=1; ans[1]:=2; for i:=1 to n do begin for j:=1 to len do ans[j]:=ans[j] << 1; for j:=1 to len do if ans[j]>=base then begin
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2011 for the course CS 001 taught by Professor 001 during the Spring '11 term at Shandong University.

Ask a homework question - tutors are online