-
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
完成作业2018081302016 #43
Open
XudxDon
wants to merge
14
commits into
luckymark:master
Choose a base branch
from
XudxDon: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 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cf866a3
完成了p01,p02,p03,p04,p05,p06,p08
09d23db
提交作业
257dc30
Update Goldbach.cpp
XudxDon e828bb8
Update Diophantus.cpp
XudxDon af7e1b1
Update isPrime.cpp
XudxDon bd4f00a
Update allPrime.cpp
XudxDon 9c7356e
Update C语言学习笔记.md
XudxDon 2709d9e
maze push_box linked_list encrpt
ca4ab12
maze push_boxes encrypt linked_list
74f5376
test
XudxDon 5a81205
add
XudxDon c038029
交一下作业
XudxDon 30481d6
Gomoku
XudxDon ccb15ac
已添加 未命名绘图.drawio
XudxDon 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 <stdio.h> | ||
#include <windows.h> | ||
#include <math.h> | ||
#define len 80 | ||
void blank(int i, int t){ | ||
int j; | ||
for(;abs(i)!=t;i--){ | ||
for(j=0;j<=abs(i);j++){ | ||
printf(" "); | ||
} | ||
printf("H"); | ||
system("cls"); | ||
} | ||
} | ||
int main(){ | ||
blank(0, len); | ||
blank(len, 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,19 @@ | ||
#include <stdio.h> | ||
int main(){ | ||
int i, j, n; | ||
j=0; | ||
scanf("%d", &n); | ||
for(i=2;i<n;i++){ | ||
if(n%i==0){ | ||
j++; | ||
} | ||
|
||
} | ||
if(j==0){ | ||
printf("%d is a prime",n); | ||
} | ||
else{ | ||
printf("%d is not a prime",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,13 @@ | ||
#include <stdio.h> | ||
int main(){ | ||
int i, t; | ||
for(i=1;i<75;i++){ | ||
if(2*i%6==0 && 2*i%12==0 && 2*i%7==0){ | ||
if(i==2*i/6+2*i/12+2*i/7+9){ | ||
printf("when his son died, he is %d years old",2*i-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,16 @@ | ||
#include <stdio.h> | ||
int main(){ | ||
int i, j, k, a, b; | ||
for(i=0;i<=9;i++){ | ||
for(j=0;j<=9;j++){ | ||
for(k=1;k<=9;k++){ | ||
a=k*100+j*10+i; | ||
b=k*k*k+i*i*i+j*j*j; | ||
if(a==b){ | ||
printf("%d ",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,21 @@ | ||
#include <stdio.h> | ||
#include <time.h> | ||
int main(){ | ||
int i, j, t; | ||
clock_t ts, te; | ||
ts=clock(); | ||
for(i=2;i<=1000;i++){ | ||
t=0; | ||
for(j=2;j<i;j++){ | ||
if(i%j==0){ | ||
t++; | ||
} | ||
} | ||
if(t==0){ | ||
printf("%d \n",i); | ||
} | ||
} | ||
te=clock(); | ||
printf("\n%d ms",te-ts); | ||
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,34 @@ | ||
#include <stdio.h> | ||
#define range 100 | ||
int isPrime(int num); | ||
int main(){ | ||
int i, j, k, goldbach; | ||
goldbach=0; | ||
for(i=4;i<=range;i+=2){ | ||
for(j=2;j<=i/2;j++){ | ||
k=i-j; | ||
if(isPrime(k) && isPrime(j)){ | ||
goldbach++; | ||
break; | ||
} | ||
} | ||
} | ||
if(goldbach==range/2-1) | ||
printf("%dis workable",range); | ||
else | ||
printf("%d is not workable",range); | ||
return 0; | ||
} | ||
int isPrime(int num){ | ||
int i, t; | ||
t=0; | ||
for(i=2;i<num;i++){ | ||
if(num%i==0){ | ||
t++; | ||
} | ||
} | ||
if(t==0) | ||
return 1; | ||
else | ||
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,19 @@ | ||
#include <stdio.h> | ||
#define N 64 | ||
void exchange(int n, char a, char b, char c) ; | ||
int main(){ | ||
exchange(N, 'a', 'b','c'); | ||
|
||
} | ||
void exchange(int n, char a, char b, char c){ | ||
if(n==1){ | ||
printf("%c->%c\n", a, c); | ||
//return; | ||
} | ||
else{ | ||
exchange(n-1, a, c, b); | ||
printf("%c->%c\n",a, c); | ||
exchange(n-1,b, a, c); | ||
|
||
} | ||
} |
Binary file not shown.
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.
也可以写成:return t==0?1:0; 比较简洁一点