-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -12,6 +12,6 @@ | |
|
||
儿子比父亲先死四年, | ||
|
||
年级是他的一半。 | ||
年纪是他的一半。 | ||
|
||
问儿子死时丢番图多大? |
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,59 @@ | ||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int i = 2; | ||
int IsPrime = 1; | ||
int a[50] = { 0 }; | ||
int k = 0; | ||
for (i = 2; i <= 100; i++) | ||
{ | ||
IsPrime = 1; | ||
for (int j = 2; j <= i / 2; j++) | ||
{ | ||
if (i % j == 0) | ||
{ | ||
IsPrime = 0; | ||
break; | ||
} | ||
} | ||
if (IsPrime == 1) | ||
{ | ||
a[k] = i; | ||
k++; | ||
} | ||
} | ||
int sum = 0; | ||
int h = 4; | ||
for (h = 4; h <= 100; h = h + 2) | ||
{ | ||
int s = 1; | ||
for (int x = 0; x < k; x++) | ||
{ | ||
for (int y = 0; y <= x; y++) | ||
{ | ||
if (a[x] + a[y] == h) | ||
{ | ||
s = 0; | ||
break; | ||
} | ||
} | ||
if (s == 0) | ||
{ | ||
break; | ||
} | ||
} | ||
if (s == 0) | ||
{ | ||
sum++; | ||
} | ||
} | ||
if (sum == 49) | ||
{ | ||
printf("哥德巴赫猜想在100范围内是正确的"); | ||
} | ||
else | ||
{ | ||
printf("哥德巴赫猜想在100范围内不是正确的"); | ||
} | ||
} |