-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
level-01-zhouzijian #9
Open
Kailai1104
wants to merge
30
commits into
luckymark:master
Choose a base branch
from
Kailai1104:level-01-zhouzijian2000
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
16c6807
Create p01_runningLetter
Kailai1104 113fd92
Create p02_isPrime
Kailai1104 b4d24fa
Create p03_Diophantus
Kailai1104 e8012e7
Create p04_ narcissus
Kailai1104 83c7a29
Create p05_allPrimes
Kailai1104 3e648f3
Create p06_Goldbach
Kailai1104 be41fbb
Update p06_Goldbach
Kailai1104 6695f88
Create 汉诺塔
Kailai1104 6734219
Update and rename 汉诺塔 to p08_hanoi
Kailai1104 89105f1
Create p09_maze
Kailai1104 96003c0
Update p01_runningLetter
Kailai1104 53ad6f8
Create p07_encrypt_decrypt
Kailai1104 afd3607
Create p11_linkedList
Kailai1104 8872a2f
Update p11_linkedList
Kailai1104 01a18d7
Rename p01_runningLetter to p01_runningLetter.cpp
Kailai1104 09ca387
Rename p02_isPrime to p02_isPrime.cpp
Kailai1104 b7e1499
Rename p03_Diophantus to p03_Diophantus.cpp
Kailai1104 c89c432
Rename p04_ narcissus to p04_narcissus.cpp
Kailai1104 1dcb458
Rename p05_allPrimes to p05_allPrimes.cpp
Kailai1104 2b97a42
Rename p06_Goldbach to p06_Goldbach.cpp
Kailai1104 d5de3eb
Rename p07_encrypt_decrypt to p07_encrypt_decrypt.cpp
Kailai1104 6007304
Rename p08_hanoi to p08_hanoi.cpp
Kailai1104 78b9e44
Update and rename p09_maze to p09_maze.cpp
Kailai1104 ceab9e9
Rename p11_linkedList to p11_linkedList.cpp
Kailai1104 89343a5
Update p11_linkedList.cpp
Kailai1104 f5a0ce3
Create p12_warehouse.cpp
Kailai1104 ece2bdf
Update p09_maze.cpp
Kailai1104 0243059
Add files via upload
Kailai1104 7701f89
Add files via upload
Kailai1104 c1f4c30
Update p10_pushboxs.cpp
Kailai1104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int cnt,v; | ||
int main() | ||
{ | ||
while(1) | ||
{ | ||
for(int i=0;i<=120;i++) | ||
{ | ||
cout<<setw(i)<<'A'; | ||
system("cls"); | ||
} | ||
for(int i=119;i>0;i--) | ||
{ | ||
cout<<setw(i)<<'A'; | ||
system("cls"); | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int n; | ||
int main() | ||
{ | ||
cin>>n; | ||
int m=(int)sqrt(n)+1; | ||
for(int i=2;i<m;i++) | ||
{ | ||
if(n%i==0) | ||
{ | ||
cout<<"NO"<<endl; | ||
return 0; | ||
} | ||
} | ||
cout<<"YES"<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
for(float i=1;;i++) | ||
{ | ||
if(i/6+i/12+i/7+5+4==i/2) | ||
{ | ||
cout<<i<<endl; | ||
return 0; | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int cub(int x) | ||
{ | ||
return x*x*x; | ||
} | ||
bool nar(int x) | ||
{ | ||
int sum=0; | ||
int sum0=x; | ||
while(x>0) | ||
{ | ||
sum+=cub(x%10); | ||
x/=10; | ||
} | ||
return sum==sum0; | ||
} | ||
int main() | ||
{ | ||
for(int i=100;i<=999;i++) | ||
{ | ||
if(nar(i)) cout<<i<<" "; | ||
} | ||
cout<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include<bits/stdc++.h> | ||
#include<time.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
int isprime[1000]; | ||
for(int i=0;i<=1000;i++) | ||
{ | ||
isprime[i]=1; | ||
} | ||
for(int i=2;i<=1000;i++) | ||
{ | ||
if(isprime[i]==1) | ||
{ | ||
cout<<i<<" "; | ||
for(int j=2;i*j<=1000;j++) | ||
{ | ||
isprime[i*j]=0; | ||
} | ||
} | ||
} | ||
cout<<endl; | ||
printf("Time used = %.4fs\n", (double)clock() / CLOCKS_PER_SEC);//单位秒 | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int n,p[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97},r[3]; | ||
void dfs(int x,int s) | ||
{ | ||
if(s>3) return; | ||
else if(x==n && s==3 && r[0]<=r[1] && r[1]<=r[2]) | ||
{ | ||
cout<<r[0]<<"+"<<r[1]<<"+"<<r[2]<<"="<<n<<endl; | ||
} | ||
else | ||
{ | ||
for(int i=0;i<25;i++) | ||
{ | ||
if((x+p[i])<=n) | ||
{ | ||
r[s]=p[i]; | ||
dfs(x+p[i],s+1); | ||
} | ||
} | ||
} | ||
} | ||
int main() | ||
{ | ||
cin>>n; | ||
if(n<=5 || n>100) cout<<"error"<<endl; | ||
else dfs(0,0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
void hano(int n,char a,char b,char c)//n是准备移动的块数,a是起始柱,b是中间柱,c是目标柱; | ||
{ | ||
if(n==0) return; | ||
hano(n-1,a,c,b);//先将第n个盘子上的n-1个盘子从a移到b; | ||
printf("将第%d号盘子从%c柱移动到%c柱\n",n,a,c); | ||
hano(n-1,b,c,a);//再将n-1个盘子从b移到c,完成任务; | ||
} | ||
int main() | ||
{ | ||
cout<<"请输入盘子总数:"; | ||
int n; | ||
cin>>n; | ||
hano(n,'A','B','C'); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#include<bits/stdc++.h> | ||
#include <conio.h> | ||
using namespace std; | ||
int xx[]={1,-1,0,0},yy[]={0,0,1,-1},v[44][44],mp[44][44]; | ||
struct Node | ||
{ | ||
int nx,ny; | ||
}nod; | ||
void dfs(int x,int y) | ||
{ | ||
mp[x][y]=1; | ||
if(x==1 && y==1) return; | ||
int s=rand()%4; | ||
for(int i=s;i<s+4;i++) | ||
{ | ||
int dx=x+xx[i%4]; | ||
int dy=y+yy[i%4]; | ||
if(mp[dx][dy]==0 && dx>0 && dy>0 && dx<43 && dy<43 && v[dx][dy]==0) | ||
{ | ||
int flag=0; | ||
for(int k=0;k<4;k++) | ||
{ | ||
int ddx=dx+xx[k]; | ||
int ddy=dy+yy[k]; | ||
if(mp[ddx][ddy]==1) flag++; | ||
} | ||
if(flag==1)//保证不和别的路挖穿,增加迷宫难度; | ||
{ | ||
v[dx][dy]=1; | ||
dfs(dx,dy); | ||
} | ||
} | ||
else v[dx][dy]=1; | ||
} | ||
} | ||
int main() | ||
{ | ||
for(int i=0;i<44;i++) | ||
{ | ||
for(int j=0;j<44;j++) mp[i][j]=0; | ||
} | ||
dfs(42,42); | ||
mp[1][0]=2; | ||
mp[42][43]=1; | ||
for(int i=0;i<44;i++) | ||
{ | ||
for(int j=0;j<44;j++) | ||
{ | ||
if(mp[i][j]==1) cout<<" "; | ||
else if(mp[i][j]==0) cout<<"口"; | ||
else if(mp[i][j]==2) cout<<"睿"; | ||
} | ||
cout<<endl; | ||
} | ||
nod.nx=1; | ||
nod.ny=0; | ||
while(1) | ||
{ | ||
int x0=nod.nx; | ||
int y0=nod.ny; | ||
if(x0==42 && y0==43) | ||
{ | ||
cout<<"睿睿好棒我好爱!"<<endl; | ||
cout<<"注:王睿是我老婆,望周知 :-)"<<endl; | ||
system("pause"); | ||
break; | ||
} | ||
int x1,y1; | ||
char t=_getch(); | ||
if(t=='w') | ||
{ | ||
x1=x0-1; | ||
y1=y0; | ||
} | ||
else if(t=='s') | ||
{ | ||
x1=x0+1; | ||
y1=y0; | ||
} | ||
else if(t=='a') | ||
{ | ||
x1=x0; | ||
y1=y0-1; | ||
} | ||
else if(t=='d') | ||
{ | ||
x1=x0; | ||
y1=y0+1; | ||
} | ||
if(mp[x1][y1]==1) | ||
{ | ||
nod.nx=x1; | ||
nod.ny=y1; | ||
mp[x0][y0]=1; | ||
mp[x1][y1]=2; | ||
system("cls"); | ||
for(int i=0;i<44;i++) | ||
{ | ||
for(int j=0;j<44;j++) | ||
{ | ||
if(mp[i][j]==1) cout<<" "; | ||
else if(mp[i][j]==0) cout<<"口"; | ||
else if(mp[i][j]==2) cout<<"睿"; | ||
} | ||
cout<<endl; | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
重复的味道,尝试消除吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经搞定了