-
河內塔問題
#include<stdio.h>
#include<stdlib.h>
int fun_a(int)
void fun_b(int,int,int,int)
int main(void)
{
int n
int option
printf("題目二:河內塔問題\n")
printf("請輸入要搬移的圓盤數目\n")
scanf("%d",&n)
printf("最少搬移的次數為%d次\n",fun_a(n))
printf("是否顯示移動過程? 是請輸入1,否則輸入0\n")
scanf("%d",&option)
if(option==1)
{
fun_b(n,1,2,3)
}
system("pause")
return 0
}
int fun_a(int n)
{
int sum1=2,sum2=0,i
for(i=n i>1 i--)
{
sum1=sum1*2
}
sum2=sum1-1
return sum2
}
void fun_b(int n,int left,int mid,int right)
{
if(n==1)
printf("把第%d個盤子從第%d座塔移動到第%d座塔\n",n,left,right)
else
{
fun_b(n-1,left,right,mid)
printf("把第%d個盤子從第%d座塔移動到第%d座塔\n",n,left,right)
fun_b(n-1,mid,left,right)
}
}
標簽:
int
include
stdlib
fun_a
上傳時間:
2016-12-08
上傳用戶:努力努力再努力
-
Problem B:Longest Ordered Subsequence
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <= i1 < i2 < ... < iK <= N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences are of length 4, e. g., (1, 3, 5, 8).
標簽:
Subsequence
sequence
Problem
Longest
上傳時間:
2016-12-08
上傳用戶:busterman
-
selects the mux channel and configures the MAX197 for
second write pulse, written with ACQMOD = 0, termi-
either unipolar or bipolar input range. A write pulse (WR
nates acquisition and starts conversion on WR°Os risin
+ CS) can either start an acquisition interval or initiate a
edge (Figure 6). However, if the second control byte
combined acquisition plus conversion. The sampling
contains ACQMOD = 1, an indefinite acquisition interval
interval occurs at the end of the acquisition interval.
is restarted.
The ACQMOD bit in the input control byte offer
標簽:
configures
the
selects
channel
上傳時間:
2013-12-09
上傳用戶:
-
selects the mux channel and configures the MAX197 for
second write pulse, written with ACQMOD = 0, termi-
either unipolar or bipolar input range. A write pulse (WR
nates acquisition and starts conversion on WR°Os risin
+ CS) can either start an acquisition interval or initiate a
edge (Figure 6). However, if the second control byte
combined acquisition plus conversion. The sampling
contains ACQMOD = 1, an indefinite acquisition interval
interval occurs at the end of the acquisition interval.
is restarted.
The ACQMOD bit in the input control byte offer
標簽:
configures
the
selects
channel
上傳時間:
2016-12-24
上傳用戶:朗朗乾坤
-
selects the mux channel and configures the MAX197 for
second write pulse, written with ACQMOD = 0, termi-
either unipolar or bipolar input range. A write pulse (WR
nates acquisition and starts conversion on WR°Os risin
is restarted.
The ACQMOD bit in the input control byte offer+ CS) can either start an acquisition interval or initiate a
edge (Figure 6). However, if the second control byte
combined acquisition plus conversion. The sampling
contains ACQMOD = 1, an indefinite acquisition interval
interval occurs at the end of the acquisition interval.
標簽:
configures
the
selects
channel
上傳時間:
2016-12-24
上傳用戶:yzhl1988
-
Hello User
This is nothing, but a simple program which if kept in start of windows will shut down the system by itself within five minutes of starting.
It takes the time from the system & starts its timer to shut down after 5 minutes (not considering seconds).
U can use shutdown.exe,once started there is only one exit that u know only.
EXIT : DOUBLECLICK TIME TO ENABLE EXIT
標簽:
nothing
program
windows
simple
上傳時間:
2016-12-26
上傳用戶:ynwbosss
-
Hello User
This is nothing, but a simple program which if kept in start of windows will shut down the system by itself within five minutes of starting.
It takes the time from the system & starts its timer to shut down after 5 minutes (not considering seconds).
U can use shutdown.exe,once started there is only one exit that u know only.
EXIT : DOUBLECLICK TIME TO ENABLE EXIT
標簽:
nothing
program
windows
simple
上傳時間:
2014-12-20
上傳用戶:xinyuzhiqiwuwu
-
Hello User
This is nothing, but a simple program which if kept in start of windows will shut down the system by itself within five minutes of starting.
It takes the time from the system & starts its timer to shut down after 5 minutes (not considering seconds).
U can use shutdown.exe,once started there is only one exit that u know only.
EXIT : DOUBLECLICK TIME TO ENABLE EXIT
標簽:
nothing
program
windows
simple
上傳時間:
2016-12-26
上傳用戶:xfbs821
-
Hello User
This is nothing, but a simple program which if kept in start of windows will shut down the system by itself within five minutes of starting.
It takes the time from the system & starts its timer to shut down after 5 minutes (not considering seconds).
U can use shutdown.exe,once started there is only one exit that u know only.
EXIT : DOUBLECLICK TIME TO ENABLE EXIT
標簽:
nothing
program
windows
simple
上傳時間:
2016-12-26
上傳用戶:lx9076
-
Hello User
This is nothing, but a simple program which if kept in start of windows will shut down the system by itself within five minutes of starting.
It takes the time from the system & starts its timer to shut down after 5 minutes (not considering seconds).
U can use shutdown.exe,once started there is only one exit that u know only.
EXIT : DOUBLECLICK TIME TO ENABLE EXIT
標簽:
nothing
program
windows
simple
上傳時間:
2016-12-26
上傳用戶:yxgi5