文件名称:java3
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:53.79kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
实验四:毕达哥拉斯三元组
实验目的:1.嵌套的for循环。
2.使用计数器控制的循环。
3.使用“强力(brute force)”来解决问题。
问题描述:直角三角形的各边长度都可以为整数。这组代表直角三角形各边的整型值称为
毕达哥拉斯三元组。这3条边必须满足如下关系:两条直角边的平方和等于斜边的平方。在1到500的范围内,找出所有适合于side1,side2和hypotenuse的整形毕达哥拉斯三元组。使用一个3层嵌套的for循环尝试所有可能的情况。该程序是“强力”计算的一个例子。在
更加高级的计算机科学课程中,你会学习到许多有趣的问题,这些问题只能运用“强力”手段予以解决,因为还没有找到其他的算法。注意:这里给出的示例输出只显示了17个毕达哥拉斯三元组,其实还有许多。
-Experiment 4: Pythagorean triples purpose of the experiment: a nested for loop. (2) using the cycle counter control. (3) using the strong (a brute force) to solve the problem. Problem Descr iption: right triangle the length of each side can be thought integers. This group represents the integer value of a right triangle each side is known as Pythagorean triples. The three sides must satisfy the following relationship: the square and the square of the hypotenuse is equal to two right angles to the edge. Within the range of 1-500 to identify all side1, side2 and hypotenuse plastic Pythagorean triples. Using a three-layer nested for loop to try all possible situations. The program is an example of " brute force" calculation. In the more advanced computer science courses, you will learn many interesting problems, these problems can only use " brute force" means to be resolved have not yet found the other algorithms. Note: The sample output shows only 17 Pythagorean triples
实验目的:1.嵌套的for循环。
2.使用计数器控制的循环。
3.使用“强力(brute force)”来解决问题。
问题描述:直角三角形的各边长度都可以为整数。这组代表直角三角形各边的整型值称为
毕达哥拉斯三元组。这3条边必须满足如下关系:两条直角边的平方和等于斜边的平方。在1到500的范围内,找出所有适合于side1,side2和hypotenuse的整形毕达哥拉斯三元组。使用一个3层嵌套的for循环尝试所有可能的情况。该程序是“强力”计算的一个例子。在
更加高级的计算机科学课程中,你会学习到许多有趣的问题,这些问题只能运用“强力”手段予以解决,因为还没有找到其他的算法。注意:这里给出的示例输出只显示了17个毕达哥拉斯三元组,其实还有许多。
-Experiment 4: Pythagorean triples purpose of the experiment: a nested for loop. (2) using the cycle counter control. (3) using the strong (a brute force) to solve the problem. Problem Descr iption: right triangle the length of each side can be thought integers. This group represents the integer value of a right triangle each side is known as Pythagorean triples. The three sides must satisfy the following relationship: the square and the square of the hypotenuse is equal to two right angles to the edge. Within the range of 1-500 to identify all side1, side2 and hypotenuse plastic Pythagorean triples. Using a three-layer nested for loop to try all possible situations. The program is an example of " brute force" calculation. In the more advanced computer science courses, you will learn many interesting problems, these problems can only use " brute force" means to be resolved have not yet found the other algorithms. Note: The sample output shows only 17 Pythagorean triples
(系统自动生成,下载前可以参看下载内容)
下载文件列表
java3.doc
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.