-
1.有三根桿子A,B,C。A桿上有若干碟子
2.每次移動一塊碟子,小的只能疊在大的上面
3.把所有碟子從A桿全部移到C桿上
經過研究發現,漢諾塔的破解很簡單,就是按照移動規則向一個方向移動金片:
如3階漢諾塔的移動:A→C,A→B,C→B,A→C,B→A,B→C,A→C
此外,漢諾塔問題也是程序設計中的經典遞歸問題
標簽:
移動
發現
上傳時間:
2016-07-25
上傳用戶:gxrui1991
-
一個神經網絡的工具箱,用于M a t l a b中
標簽:
神經網絡
工具箱
上傳時間:
2016-09-28
上傳用戶:zhanditian
-
The "GEE! It s Simple" package illustrates Gaussian elimination with partial pivoting, which produces a factorization of P*A into the product L*U where P is a permutation matrix, and L and U are lower and upper triangular, respectively.
The functions in this package are accurate, but they are far slower than their MATLAB equivalents (x=A\b, [L,U,p]=lu(A), and so on). They are presented here merely to illustrate and educate. "Real" production code should use backslash and lu, not this package.
標簽:
illustrates
elimination
Gaussian
pivoting
上傳時間:
2016-11-09
上傳用戶:wang5829
-
The "GEE! It s Simple" package illustrates Gaussian elimination with partial pivoting, which produces a factorization of P*A into the product L*U where P is a permutation matrix, and L and U are lower and upper triangular, respectively.
The functions in this package are accurate, but they are far slower than their MATLAB equivalents (x=A\b, [L,U,p]=lu(A), and so on). They are presented here merely to illustrate and educate. "Real" production code should use backslash and lu, not this package.
標簽:
illustrates
elimination
Gaussian
pivoting
上傳時間:
2014-01-21
上傳用戶:lxm
-
溫度華氏轉變攝氏
#include <stdio.h>
#include <stdlib.h>
enum x {A,B,C,D,E}
int main(void)
{
int a=73,b=85,c=66
{
if (a>=90)
printf("a=A等級!!\n")
else if (a>=80)
printf("73分=B等級!!\n")
else if (a>=70)
printf("73分=C等級!!\n")
else if (a>=60)
printf("73分=D等級!!\n")
else if (a<60)
printf("73分=E等級!!\n")
}
{
if (b>=90)
printf("b=A等級!!\n")
else if (b>=80)
printf("85分=B等級!!\n")
else if (b>=70)
printf("85分=C等級!!\n")
else if (b>=60)
printf("85分=D等級!!\n")
else if (b<60)
printf("85分=E等級!!\n")
}
{
if (c>=90)
printf("c=A等級!!\n")
else if (c>=80)
printf("66分=B等級!!\n")
else if (c>=70)
printf("66分=C等級!!\n")
else if (c>=60)
printf("66分=D等級!!\n")
else if (c<60)
printf("66分=E等級!!\n")
}
system("pause")
return 0
}
標簽:
include
stdlib
stdio
gt
上傳時間:
2014-11-10
上傳用戶:wpwpwlxwlx
-
溫度華氏轉變攝氏
#include <stdio.h>
#include <stdlib.h>
enum x {A,B,C,D,E}
int main(void)
{
int a=73,b=85,c=66
{
if (a>=90)
printf("a=A等級!!\n")
else if (a>=80)
printf("73分=B等級!!\n")
else if (a>=70)
printf("73分=C等級!!\n")
else if (a>=60)
printf("73分=D等級!!\n")
else if (a<60)
printf("73分=E等級!!\n")
}
{
if (b>=90)
printf("b=A等級!!\n")
else if (b>=80)
printf("85分=B等級!!\n")
else if (b>=70)
printf("85分=C等級!!\n")
else if (b>=60)
printf("85分=D等級!!\n")
else if (b<60)
printf("85分=E等級!!\n")
}
{
if (c>=90)
printf("c=A等級!!\n")
else if (c>=80)
printf("66分=B等級!!\n")
else if (c>=70)
printf("66分=C等級!!\n")
else if (c>=60)
printf("66分=D等級!!\n")
else if (c<60)
printf("66分=E等級!!\n")
}
system("pause")
return 0
}
標簽:
include
stdlib
stdio
gt
上傳時間:
2013-12-12
上傳用戶:亞亞娟娟123
-
Instead of finding the longest common
subsequence, let us try to determine the
length of the LCS.
Then tracking back to find the LCS.
Consider a1a2…am and b1b2…bn.
Case 1: am=bn. The LCS must contain am,
we have to find the LCS of a1a2…am-1 and
b1b2…bn-1.
Case 2: am≠bn. Wehave to find the LCS of
a1a2…am-1 and b1b2…bn, and a1a2…am and
b b b
b1b2…bn-1
Let A = a1 a2 … am and B = b1 b2 … bn
Let Li j denote the length of the longest i,g g
common subsequence of a1 a2 … ai and b1 b2
… bj.
Li,j = Li-1,j-1 + 1 if ai=bj
max{ L L } a≠b i-1,j, i,j-1 if ai≠j
L0,0 = L0,j = Li,0 = 0 for 1≤i≤m, 1≤j≤n.
標簽:
the
subsequence
determine
Instead
上傳時間:
2013-12-17
上傳用戶:evil
-
#include<stdio.h>
#include<windows.h>
int xuanxiang;
int studentcount;
int banjihao[100];
int xueqihao[100][10];
char xm[100][100];
int xuehao[100][10];
int score[100][3];
int yuwen;
int shuxue[000];
int yingyu[100];
int c[100];
int p;
char x[1000][100]="",y[100][100]="";/*x學院 y專業 z班級*/
int z[100];
main()
{
void input();
void inputsc();
void alter();
void scbybannji();
printf("--------學生成績管理-----\n");
printf("請按相應數字鍵來實現相應功能\n");
printf("1.錄入學生信息 2.錄入學生成績 3.修改學生成績\n");
printf("4.查詢學生成績 5.不及格科目及名單 6.按班級輸出學生成績單\n");
printf("請輸入你要實現的功能所對應的數字:");
scanf("%d",&xuanxiang);
system("cls");
getchar();
switch (xuanxiang)
{
case 1:input();
case 2:inputsc();
case 3:alter();
/*case 4:select score();
case 5:bujigekemujimingdan();*/
case 6:scbybanji;
}
}
void input()
{
int i;
printf("請輸入你的學院名稱:");
gets(x);
printf("請輸入你的專業名稱:");
gets(y);
printf("請輸入你的班級號:");
scanf("%d",&z);
printf("請輸入你們一個班有幾個人:");
scanf("%d",&p);
system("cls");
for(i=0;i<p;i++)
{
printf("請輸入第%d個學生的學號:",i+1);
scanf("%d",xuehao[i]);
getchar();
printf("請輸入第%d個學生的姓名:",i+1);
gets(xm[i]);
system("cls");
}
printf("您已經錄入完畢您的班級所有學生的信息!\n");
printf("您的班級為%s%s%s\n",x,y,z);
/*alter(p);*/
}
void inputsc()
{
int i;
for(i=0;i<p;i++)
{
printf("\n");
printf("--------------------------------------------------------------------------------\n\n");
printf("\t\t\t\t錄入學生的成績\n\n\n");
printf("--------------------------------------------------------------------------------\n\n");
printf("\t\t\t\t%s\n",xm[i]);
printf("\n");
printf("\t\t\t\t數學:");
scanf("%d",&shuxue[i]);
printf("\n");
getchar();
printf("\t\t\t\t英語:");
scanf("%d",&yingyu[i]);
printf("\n");
getchar();
printf("\t\t\t\tc語言:");
scanf("%d",&c[i]);
system("cls");
}
}
void alter()
{
int i;/*循環變量*/
int m[10000];/*要查詢的學號*/
int b;/*修改后的成績*/
char kemu[20]="";
printf("請輸入你要修改的學生的學號");
scanf("%d",&m);
for (i=0;i<p;i++)
{
if (m==xuehao[i])
{
printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]");
printf("請輸入你想修改的科目");}
}
gets(kemu);
getchar();
if (kemu=="數學");
{
scanf("%d",&b);
shuxue[i]=b;}
if (kemu=="英語");
{
scanf("%d",&b);
yingyu[i]=b;}
if (kemu=="c語言");
{
scanf("%d",&b);
c[i]=b;
}
printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]");
}
void scbybannji()
{
int i;
char zyname[20];
int bjnumber;
printf("請輸入你的專業名稱");
scanf("%s",&zyname);
printf("請輸入你的班級號");
scanf("%d",&bjnumber);
for (i=0;i<p;i++)
{
if (zyname==y[i]);
if (bjnumber==z[i]);
printf("專業名稱%s班級號%d數學成績%d英語成績%dc語言成績%d,y[i],z[i],shuxue[i],yingyu[i],c[i]");
}
}
標簽:
c語言
上傳時間:
2018-06-08
上傳用戶:2369043090
-
最接近點對問題是求二維坐標中的點對問題,該算法是為了將平面上點集S線性分割為大小大致相等的2個子集S1和S2,我們選取一垂直線l:x=m來作為分割直線。其中m為S中各點x坐標的中位數。由此將S分割為S1={p∈S|px≤m}和S2={p∈S|px>m}。從而使S1和S2分別位于直線l的左側和右側,且S=S1∪S2 。由于m是S中各點x坐標值的中位數,因此S1和S2中的點數大致相等。
遞歸地在S1和S2上解最接近點對問題,我們分別得到S1和S2中的最小距離δ1和δ2。現設δ=min(δ1,δ1)。若S的最接近點對(p,q)之間的距離d(p,q)<δ則p和q必分屬于S1和S2。不妨設p∈S1,q∈S2。那么p和q距直線l的距離均小于δ。因此,我們若用P1和P2分別表示直線l的左邊和右邊的寬為δ的2個垂直長條,則p∈S1,q∈S2。
標簽:
二維
上傳時間:
2015-05-19
上傳用戶:shawvi
-
#include<iostream>
using namespace std
int main()
{
unsigned long x,warcraft,war,l
cin> x
while(x)
{
unsigned long *p=new unsigned long[x+1]
if(p==NULL)
{
cerr<<"error!"<<endl
abort()
}
for(warcraft=0 warcraft<=x warcraft++)
*(p+warcraft)=0
*p=1
for(warcraft=0 warcraft<x warcraft++)
{
cout<<*p<<" "
war=*p
for(l=1 x>1 l++)
{
if(*(p+l)==0)
{
cout<<endl
*(p+l)=1
break
}
else
{
cout<<*(p+l)<<" "
*(p+l)=war+*(p+l)
war=*(p+l)-war
}
}
}
cout<<endl
delete [] p
cin>>x
}
return 0
}
標簽:
namespace
iostream
unsigned
warcraft
上傳時間:
2015-12-12
上傳用戶:manlian