-
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
原杨锴♂2018081303017 #29
Open
GhostNoir
wants to merge
22
commits into
luckymark:master
Choose a base branch
from
GhostNoir: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
22 commits
Select commit
Hold shift + click to select a range
7afbde2
Create runningLetter.c
GhostNoir ad08aff
Delete runningLetter.c
GhostNoir b378166
Add files via upload
GhostNoir 57a95ab
Update runningLetter.c
GhostNoir a87e2cf
Add files via upload
GhostNoir 34d1cee
Add files via upload
GhostNoir 0513c8b
Rename 2.c to narcissus.c
GhostNoir a841d9e
Add files via upload
GhostNoir 02979fd
Add files via upload
GhostNoir 8113245
Update runningLetter.c
GhostNoir 3290f30
Add files via upload
GhostNoir ccfa0d7
Update Diophantus.c
GhostNoir c1599ca
Add files via upload
GhostNoir e4143be
Update runningLetter.c
GhostNoir 88a776e
Update isPrinme.c
GhostNoir 3b7b3be
Update narcissus.c
GhostNoir 1a02108
Update allPrimes.c
GhostNoir 9cd5cbe
Add files via upload
GhostNoir 61b0893
Update maze.c
GhostNoir 9a11c77
Update narcissus.c
GhostNoir 77ecd96
Add files via upload
GhostNoir 29b66d8
Add files via upload
GhostNoir 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,30 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<windows.h> | ||
#define LENGTH 117 | ||
int main() | ||
{ | ||
int flag=0,a=0; | ||
|
||
while(1) | ||
{ | ||
for(int i=a;i>0;--i) | ||
printf(" "); | ||
|
||
printf("Van"); | ||
Sleep(70); | ||
system("cls"); | ||
|
||
if(a==0) | ||
flag=0; | ||
if(a==length) | ||
flag=1; | ||
|
||
if(flag) | ||
--a; | ||
else | ||
++a; | ||
} | ||
|
||
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,31 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
int main() | ||
{ | ||
int n,flag=1; | ||
|
||
scanf("%d",&n); | ||
if(n<=1) | ||
{ | ||
printf("%d不是素数\n",n); | ||
flag=0; | ||
} | ||
if(n%6!=1&&n%6!=5&&n>6)//如果n大于6且不与6的倍数为邻 ,n不是素数 | ||
printf("%d不是素数\n",n); | ||
else | ||
{ | ||
for(int a=sqrt(n);a>=2;--a) | ||
{ | ||
if(n%a==0) | ||
{ | ||
printf("%d不是素数\n",n); | ||
flag=0; | ||
break; | ||
} | ||
} | ||
if(flag) | ||
printf("%d是素数\n",n); | ||
} | ||
|
||
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> | ||
int main() | ||
{ | ||
for(int age=12;age<=200;++age)//不能再多了 | ||
{ | ||
if(age%12==0&&age%7==0) | ||
{ | ||
int x=age/6+age/12+age/7+5+age/2+4; | ||
if(x==age) | ||
printf("%d",x-4); | ||
} | ||
} | ||
|
||
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<stdio.h> | ||
#include<math.h> | ||
#define max 3 | ||
|
||
int main() | ||
{ | ||
int all=0; | ||
for(int x=100;x<1000;++x) | ||
{ | ||
for(int i=0;i<max;++i) | ||
all+=(int)pow((int)(x/pow(10,i))%10,max); | ||
if(x==all) | ||
printf("%d ",x); | ||
all=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,48 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
#include<time.h> | ||
|
||
clock_t start, stop; | ||
double duration; | ||
|
||
int main() | ||
{ | ||
start = clock(); | ||
|
||
int num[999]; | ||
for(int i=0;i<999;++i)//为每个数匹配一个状态,起初默认均为素数(1) | ||
{ | ||
num[i]=1; | ||
} | ||
for(int shu=2;shu<=1000;++shu)//对每个数进行判断 | ||
{ | ||
if(1==num[shu-2])// 如果还未被判断不是素数 (0) | ||
{ | ||
for(int q=sqrt(shu);q>1;--q)//暴力判断此数是否为素数 | ||
{ | ||
if(0==shu%q)//如果不是素数,标记状态(0) | ||
{ | ||
num[shu-2]=0; | ||
} | ||
} | ||
if(1==num[shu-2])//如果此数为素数 | ||
{ | ||
for(int i=2;shu*i<=1000;++i)//标记此素数的倍数为非素数(0) | ||
{ | ||
num[shu*i-2]=0; | ||
} | ||
} | ||
} | ||
} | ||
for(int i=0;i<999;++i)//对每个数,如果是素数(1)则输出 | ||
{ | ||
if(1==num[i]) | ||
printf("%d\n",i+2); | ||
} | ||
|
||
stop = clock(); | ||
duration = ((double)(stop - start))/CLK_TCK; | ||
printf("运行时间为%fs\n",duration); | ||
|
||
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,45 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
#define MAX 100 | ||
|
||
int isprime(int n); | ||
|
||
int main() | ||
{ | ||
for(int i=2,num=4;num<MAX;++i,num=2*i) | ||
{ | ||
for(int d=0;d<num/2;++d) | ||
{ | ||
int flag_1=isprime(num/2-d); | ||
int flag_2=isprime(num/2+d); | ||
if(flag_1&&flag_2) | ||
{ | ||
printf("ż��%d�ɱ���ʾΪ����%d��%d�ĺ�\n",num,num/2-d,num/2+d); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int isprime(int n) | ||
{ | ||
int flag=1; | ||
|
||
if(n%6!=1&&n%6!=5&&n>6)//���n����6�Ҳ���6�ı���Ϊ�� ,n�������� | ||
flag=0; | ||
else | ||
{ | ||
for(int a=sqrt(n);a>=2;--a) | ||
{ | ||
if(n%a==0) | ||
{ | ||
flag=0; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return flag; | ||
} |
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,32 @@ | ||
#include<stdio.h> | ||
#define LENGTH 500 | ||
|
||
int main() | ||
{ | ||
char text[LENGTH]; | ||
|
||
printf("Please choose the operation you want:\nEnter E to encrypt\nEnter D to decrypt\n"); | ||
char choice=getchar(); | ||
if(choice=='E') | ||
{ | ||
printf("Please enter the text needs to be encrypted:\n"); | ||
scanf("%s",&text); | ||
for(int i=0;i<strlen(text);++i) | ||
{ | ||
text[i]+=1; | ||
} | ||
printf("%s",text); | ||
|
||
} | ||
if(choice=='D') | ||
{ | ||
printf("Please enter the text needs to be decrypted:\n"); | ||
scanf("%s",&text); | ||
for(int i=0;i<strlen(text);++i) | ||
{ | ||
text[i]-=1; | ||
} | ||
printf("%s",text); | ||
} | ||
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> | ||
|
||
void move(char x, char y); | ||
void hanoi(int n,char one ,char two,char three) | ||
{ | ||
void move(char x,char y); | ||
if(n==1) | ||
move(one, three); | ||
else | ||
{ | ||
hanoi(n-1,one,three,two); | ||
move(one,three); | ||
hanoi(n-1,two,one,three); | ||
} | ||
} | ||
void move(char x,char y) | ||
{ | ||
printf("%c-->%c\n",x,y); | ||
} | ||
|
||
void main() | ||
{ | ||
int n; | ||
printf("input your number"); | ||
scanf("%d",&n); | ||
hanoi(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,73 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<conio.h> | ||
|
||
int main() | ||
{ | ||
int y=1,x=1; | ||
int maze[11][11]= | ||
{ | ||
{1,1,1,1,1,1,1,1,1,1,1}, | ||
{1,8,1,0,0,0,0,0,0,0,1}, | ||
{1,0,1,0,1,0,1,1,1,0,1}, | ||
{1,0,1,0,1,0,1,0,0,0,1}, | ||
{1,0,0,0,1,0,1,0,1,1,1}, | ||
{1,1,1,1,1,0,1,0,1,2,1}, | ||
{1,0,0,0,0,0,0,0,1,0,1}, | ||
{1,0,1,1,1,1,1,1,1,0,1}, | ||
{1,0,1,0,0,0,1,0,0,0,1}, | ||
{1,0,0,0,1,0,0,0,1,0,1}, | ||
{1,1,1,1,1,1,1,1,1,1,1} | ||
}; | ||
|
||
while(maze[5][9]==2) | ||
{ | ||
for(int i=0,j=0;i<11;++i) | ||
{ | ||
for(;j<11;++j) | ||
{ | ||
if(maze[i][j]==0) | ||
printf(" "); | ||
if(maze[i][j]==1) | ||
printf("#"); | ||
if(maze[i][j]==2) | ||
printf("C"); | ||
if(maze[i][j]==8) | ||
printf("Y"); | ||
} | ||
if(j==11) | ||
{ | ||
j=0; | ||
printf("\n"); | ||
} | ||
} | ||
char move=_getch(); | ||
if(move==75&&maze[y][x-1]!=1) | ||
{ | ||
maze[y][x]=0; | ||
maze[y][x-1]=8; | ||
x-=1; | ||
} | ||
if(move==77&&maze[y][x+1]!=1) | ||
{ | ||
maze[y][x]=0; | ||
maze[y][x+1]=8; | ||
x+=1; | ||
} | ||
if(move==72&&maze[y-1][x]!=1) | ||
{ | ||
maze[y][x]=0; | ||
maze[y-1][x]=8; | ||
y-=1; | ||
} | ||
if(move==80&&maze[y+1][x]!=1) | ||
{ | ||
maze[y][x]=0; | ||
maze[y+1][x]=8; | ||
y+=1; | ||
} | ||
system("cls"); | ||
} | ||
printf("You win!!!\n"); | ||
return 0; | ||
} |
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.
缩进不对,加大括号