-
Notifications
You must be signed in to change notification settings - Fork 78
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
完成了running letter #34
Open
Anson-Sun
wants to merge
18
commits into
luckymark:master
Choose a base branch
from
Anson-Sun:master
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 all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a87f783
完成了running letter
Anson-Sun 063e6c1
完成了L1_02
Anson-Sun 025e432
完成了level1 的第三题
Anson-Sun b9483e2
完成了level1第四题🍺
Anson-Sun 056caae
完成了level1第6题🐎
Anson-Sun 79f0202
完成了p05
Anson-Sun fc79a9c
完成了p05
Anson-Sun 0b548db
完成了p07
Anson-Sun b392a87
完成了p08
Anson-Sun 9b5b44a
完成了p08
Anson-Sun 4517ec5
完成了推箱子
Anson-Sun 3ce2453
完成了迷宫
Anson-Sun 23f8328
修改了推箱子的BUG,把分数存入score文件中
Anson-Sun 794ae15
完成了p12
Anson-Sun 98316cc
将迷宫改为多文件
Anson-Sun 70555e7
将推箱子修改为多文件
Anson-Sun e766926
提交五子棋作业
Anson-Sun 920fc59
提交链表
Anson-Sun 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,29 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#define LENGTH 119 | ||
int main(int argc, char *argv[]) | ||
{ | ||
int i,j,k; | ||
for(i=1;i<=LENGTH;i++) | ||
{ | ||
printf("a"); | ||
system("cls"); | ||
for(j=1;j<=i;j++) | ||
{ | ||
printf(" "); | ||
} | ||
} | ||
for(i=LENGTH;i>=1;i--) | ||
{ | ||
printf("a"); | ||
system("cls"); | ||
for(j=i;j>=1;j--) | ||
{ | ||
printf(" "); | ||
} | ||
} | ||
system("cls"); | ||
printf("a"); | ||
system("pause"); | ||
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,28 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char *argv[]) | ||
{ | ||
int i,n,k; | ||
k=1; | ||
loop:scanf("%d",&n); | ||
if(n<=0) | ||
{ | ||
printf("������һ��������\n"); | ||
goto loop; | ||
} | ||
for(i=2;i<n;i++) | ||
{ | ||
if(n%i==0) | ||
{ | ||
k=0; | ||
} | ||
} | ||
if(k==0||n==1||n==2) | ||
{ | ||
printf("��������\n"); | ||
} | ||
else | ||
printf("������\n"); | ||
system("pause"); | ||
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,15 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char *argv[]) | ||
{ | ||
float x; | ||
for(x=1;x<=100;x++) | ||
{ | ||
if(x*1/6+x*1/12+x*1/7+5+0.5*x+4==x) | ||
{ | ||
printf("��ʱ����ͼ%.0f��\n",x-4); | ||
} | ||
} | ||
system("pause"); | ||
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 <stdio.h> | ||
#include <stdlib.h> | ||
int main(int argc, char *argv[]) | ||
{ | ||
int i,a,b,c,n; | ||
printf("3λˮ�ɻ�����\n"); | ||
for(i=100;i<=999;i++) | ||
{ | ||
a=i/100; | ||
b=(i/10)%10; | ||
c=i%10; | ||
if(i==a*a*a+b*b*b+c*c*c) | ||
printf("%d=%d^3+%d^3+%d^3\n",i,a,b,c); | ||
} | ||
system("pause"); | ||
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,37 @@ | ||
#include <stdio.h> | ||
#include <time.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#define N 2000 | ||
bool prime(int n) | ||
{ | ||
int i,k; | ||
k=1; | ||
for(i=2;i<sqrt(n);i++) | ||
{ | ||
if(n%i==0) | ||
{ | ||
k=0; | ||
} | ||
} | ||
return k; | ||
} | ||
int main(int argc, char *argv[]) | ||
{ | ||
int i,s; | ||
clock_t start, finish; | ||
double Total_time; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缩进 |
||
start = clock(); | ||
for(i=2;i<=N;i++) | ||
{ | ||
if(prime(i)==1) | ||
{ | ||
printf("%d ",i); | ||
} | ||
} | ||
printf("\n"); | ||
finish = clock(); | ||
Total_time = (double)(finish-start) / CLOCKS_PER_SEC; | ||
printf( "time:%f seconds\n", Total_time); | ||
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,30 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
bool prime(int n) | ||
{ | ||
int i,k; | ||
k=1; | ||
for(i=2;i<sqrt(n);i++) | ||
{ | ||
if(n%i==0) | ||
{ | ||
k=0; | ||
} | ||
} | ||
return k; | ||
} | ||
int main(int argc, char *argv[]) | ||
{ | ||
int i,j,t,n,s; | ||
for(i=4;i<=100;i=i+2) | ||
{ | ||
for(j=2;j<i;j++) | ||
{ | ||
if((prime(j)==1)&&(prime(i-j)==1)) | ||
{ | ||
printf("%d=%d+%d\n",i,j,i-j); | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
65 changes: 65 additions & 0 deletions
65
level1/p07_encrypt_decrypt/p07_encrypt_decrypt_ASCII+5.cpp
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,65 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#define LENGTH 100000 | ||
//�˼��ܷ���Ϊ���ַ���ASCII��+5 | ||
int encrypt(char s[]) | ||
{ | ||
int a[LENGTH]; | ||
int i; | ||
for(i=1;i<=LENGTH;i++) | ||
{ | ||
a[i]=-1; | ||
} | ||
for(i=0;i<strlen(s);i++) | ||
{ | ||
a[i]=s[i]; | ||
} | ||
for(i=0;i<strlen(s);i++) | ||
{ | ||
if(a[i]!=-1) | ||
{ | ||
a[i]=a[i]+5; | ||
} | ||
} | ||
for(i=0;i<strlen(s);i++) | ||
{ | ||
s[i]=(char)a[i]; | ||
} | ||
return 0; | ||
} | ||
int decrypt(char s[]) | ||
{ | ||
int b[LENGTH]; | ||
int x; | ||
for(x=1;x<=LENGTH;x++) | ||
{ | ||
b[x]=-1; | ||
} | ||
for(x=0;x<strlen(s);x++) | ||
{ | ||
b[x]=s[x]; | ||
} | ||
for(x=0;x<strlen(s);x++) | ||
{ | ||
if(b[x]!=-1) | ||
{ | ||
b[x]=b[x]-5; | ||
} | ||
} | ||
for(x=0;x<strlen(s);x++) | ||
{ | ||
s[x]=(char)b[x]; | ||
} | ||
return 0; | ||
} | ||
int main(int argc, char *argv[]) | ||
{ | ||
char s[LENGTH]="null"; | ||
int i; | ||
scanf("%[^\n]",s); | ||
encrypt(s); | ||
printf("���ܺ�%s\n",s); | ||
decrypt(s); | ||
printf("���ܺ�%s\n",s); | ||
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,28 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <time.h> | ||
void hanoi(int n,char a,char b,char c) | ||
{ | ||
if(n==1) | ||
printf("%c��%c\n",a,c); | ||
else | ||
{ | ||
hanoi(n-1,a,c,b); | ||
printf("%c��%c\n",a,c); | ||
hanoi(n-1,b,a,c); | ||
} | ||
} | ||
int main(int argc, char *argv[]) | ||
{ | ||
int n; | ||
printf("��������������"); | ||
scanf("%d",&n); | ||
clock_t start, finish; | ||
double Total_time; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缩进 |
||
start = clock(); | ||
hanoi(n,'A','B','C'); | ||
finish = clock(); | ||
Total_time = (double)(finish-start) / CLOCKS_PER_SEC; | ||
printf( "����ʱ�䣺%f seconds\n", Total_time); | ||
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,106 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <conio.h> | ||
#include <string.h> | ||
int main(int argc, char *argv[]) | ||
{ | ||
int x,y,nkey,x0,y0; | ||
char key; | ||
char *a[100]; | ||
int i,j; | ||
for(i=0;i<15;i++) | ||
{ | ||
a[i] = (char*)malloc(sizeof(char)*100); | ||
} | ||
|
||
|
||
strcpy(a[0],"XXXXXXXXXXXXXXXXXXXXXX"); | ||
strcpy(a[1],"XXXXXXX X X ����"); | ||
strcpy(a[2],"XX XX X X X X XXXXXX"); | ||
strcpy(a[3],"X X X X X X XX"); | ||
strcpy(a[4],"X X X XXXXXX X XX"); | ||
strcpy(a[5],"X X XX X X X"); | ||
strcpy(a[6],"X X XXXXXX X XX X"); | ||
strcpy(a[7],"X XXX XX X X X X"); | ||
strcpy(a[8],"X X XX X X X X XX"); | ||
strcpy(a[9],"XXX X X X X X X X"); | ||
strcpy(a[10],"X X X X X X X X"); | ||
strcpy(a[11],"X XXX X X X XX X"); | ||
strcpy(a[12],"X XXX X XXXXXXX"); | ||
strcpy(a[13],"XoXXXXXXXXXXXXXXXXX"); | ||
strcpy(a[14]," <-�ɴ˽���"); | ||
x=13;y=1; | ||
x0=13;y0=1; | ||
printf("�Թ�С��Ϸ��w,s,a,d�������ң���ESC���˳������ǡ�o��\n"); | ||
printf("���������ʼ"); | ||
while(true) | ||
{ | ||
a[14][1]='X'; | ||
point:key=getch();nkey=(int)key; | ||
if(nkey==27)break; | ||
if(y>20) | ||
{ | ||
system("cls"); | ||
printf("��ϲ���߳��Թ�����"); | ||
break; | ||
} | ||
switch(key) | ||
{ | ||
case 'w': | ||
{ | ||
if(a[x-1][y]=='X')goto point; | ||
if((x>0)&&(a[x-1][y]!='X')) | ||
{ | ||
x--; | ||
a[x0][y0]=' '; | ||
a[x][y]='o'; | ||
x0=x;y0=y; | ||
break; | ||
} | ||
} | ||
case 'a': | ||
{ | ||
if(a[x][y-1]=='X')goto point; | ||
if((y>0)&&(a[x][y-1]!='X')) | ||
{ | ||
y--; | ||
a[x0][y0]=' '; | ||
a[x][y]='o'; | ||
x0=x;y0=y; | ||
break; | ||
} | ||
} | ||
case 'd': | ||
{ | ||
if(a[x][y+1]=='X')goto point; | ||
if(a[x][y+1]!='X') | ||
{ | ||
y++; | ||
a[x0][y0]=' '; | ||
a[x][y]='o'; | ||
x0=x;y0=y; | ||
break; | ||
} | ||
} | ||
case 's': | ||
{ | ||
if(a[x+1][y]=='X')goto point; | ||
if(a[x+1][y]!='X') | ||
{ | ||
x++; | ||
a[x0][y0]=' '; | ||
a[x][y]='o'; | ||
x0=x;y0=y; | ||
break; | ||
} | ||
}defalt:break; | ||
} | ||
system("cls");printf("�Թ�С��Ϸ��w,s,a,d�������ң���ESC���˳�\n"); | ||
for(i=0;i<15;i++) | ||
{ | ||
printf("%s\n",a[i]); | ||
} | ||
} | ||
system("pause"); | ||
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,22 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <conio.h> | ||
#include <string.h> | ||
void createmap(char *a[100]) | ||
{ | ||
strcpy(a[0],"XXXXXXXXXXXXXXXXXXXXXX"); | ||
strcpy(a[1],"XXXXXXX X X ����"); | ||
strcpy(a[2],"XX XX X X X X XXXXXX"); | ||
strcpy(a[3],"X X X X X X XX"); | ||
strcpy(a[4],"X X X XXXXXX X XX"); | ||
strcpy(a[5],"X X XX X X X"); | ||
strcpy(a[6],"X X XXXXXX X XX X"); | ||
strcpy(a[7],"X XXX XX X X X X"); | ||
strcpy(a[8],"X X XX X X X X XX"); | ||
strcpy(a[9],"XXX X X X X X X X"); | ||
strcpy(a[10],"X X X X X X X X"); | ||
strcpy(a[11],"X XXX X X X XX X"); | ||
strcpy(a[12],"X XXX X XXXXXXX"); | ||
strcpy(a[13],"XoXXXXXXXXXXXXXXXXX"); | ||
strcpy(a[14]," <-�ɴ˽���"); | ||
} |
Oops, something went wrong.
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.
尽量不用goto,可尝试用while来代替