Toggle navigation
Courses
Questions
Tags
Users
AD 20161027 期中考 10
0
like
0
dislike
1.1k
views
勾股定理(英語:Pythagorean theorem)又稱商高定理、畢達哥拉斯定理、畢氏定理、百牛定理,是平面幾何中一個基本而重要的定理。 勾股定理說明,平面上的直角三角形的兩條直角邊的長度(古稱勾長、股長)的平方和等於斜邊長(古稱弦長)的平方。請設計一個程式,找出週常在N已內所有符合勾股定理的整數三角形三邊長。請注意不要重複喔。
sample input:
100
sample output:
3 4 5
5 12 13
6 8 10
7 24 25
8 15 17
9 12 15
9 40 41
10 24 26
12 16 20
12 35 37
15 20 25
15 36 39
16 30 34
18 24 30
20 21 29
21 28 35
24 32 40
[Exercise]
Coding (C)
-
asked
Oct 27, 2016
in
2016-1 程式設計(一)AD
by
Shun-Po
(
18k
points)
ID: 15448 -
Available when:
2016-10-27 18:30:00
-
Due to:
2016-10-27 21:00:00
reshown
Oct 27, 2016
by
Shun-Po
|
1.1k
views
comment
Please
log in
or
register
to add a comment.
5
Answers
0
like
0
dislike
Hidden content!#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,d;
** ** ** * ** *** * * *** * * *** * * **
for(c=1;c<=d/100*41;c++)
{
* * * * *** * ** * * ** * * ** *** * *** * * *** * * * * * **
* * **** * * * * * ** * * * * ** * * *
** * ** * * *** ** * * * ** ** * **** ** **** ** * *** * * * * *** * * *** * * * *
** *** *** * * * * ** * * * * * * * * * * * * * * * * ** ** *
* * * * * ** * * *** * ** ** * * * * * ** * * *** * ** ** * *** * * ** ** ** * * * **** * * ** * ** ** ***
** * * *** * * * * * *** * ** ** * * ** * * ****** * **** ** * *** ** * * ** *** *
** *** * ** *** * * *** * * *** * * * * * * ** ** ** * ** * * * * ** *** * ** * * ** * * * * ** * * *** ** * * ** ** * * *** * * * %d %d\n",a,b,c);
* ** * *** * * * * * * ** * * * * * * * * * ** ** * * * * * *** * ** * * **
* * ** *** ** * **** * * * * * *** * * * * **** ** * * * * * * *
* * ** ** ** * ** * *** ** * ***** * *** * * *
}
*** * * * ** * * ****** *** ** ** *
return 0;
}
answered
Oct 27, 2016
by
steven0221
(
-90
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int i,n,a,b,c;
scanf("%d",&n);
for(a = 1; a < n; a++){
for(b = a;b <= n-a ; b++){
* * **** * * * * * * * * * * *** ** * * * * ** * * *** * * * = 5; c <=(n-a-b);c++){