文件名称:classical-algorithm-c-language
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:68.66kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
c语言经典算法
【程序1】
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去
掉不满足条件的排列。
2.程序源代码:
main()
{
int i,j,k
printf("\n")
for(i=1 i<5 i++) /*以下为三重循环*/
for(j=1 j<5 j++)
for (k=1 k<5 k++)
{
if (i!=k&&i!=j&&j!=k) /*确保i、j、k三位互不相同*/
printf(" d, d, d\n",i,j,k)
}
}
-classical algorithm c language program 1】 【Title: There are numbers 1,2,3,4, how many can be composed of distinct three-digit numbers with no repetition? Is how much? 1. Program Analysis: fill in the hundred, ten, a bit of the numbers are 1,2,3,4. Removed after the composition does not satisfy all the conditions of the arrangement of the arrangement. 2. Program source code: main () {int i, j, k printf (" \ n" ) for (i = 1 i < 5 i++) /* The following is the triple loop*/for (j = 1 j < 5 j++) for (k = 1 k < 5 k++) {if (i! = k & & i! = j & & j! = k) /* ensure i, j, k three distinct*/printf ( " d, d, d \ n" , i, j, k) }}
【程序1】
题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去
掉不满足条件的排列。
2.程序源代码:
main()
{
int i,j,k
printf("\n")
for(i=1 i<5 i++) /*以下为三重循环*/
for(j=1 j<5 j++)
for (k=1 k<5 k++)
{
if (i!=k&&i!=j&&j!=k) /*确保i、j、k三位互不相同*/
printf(" d, d, d\n",i,j,k)
}
}
-classical algorithm c language program 1】 【Title: There are numbers 1,2,3,4, how many can be composed of distinct three-digit numbers with no repetition? Is how much? 1. Program Analysis: fill in the hundred, ten, a bit of the numbers are 1,2,3,4. Removed after the composition does not satisfy all the conditions of the arrangement of the arrangement. 2. Program source code: main () {int i, j, k printf (" \ n" ) for (i = 1 i < 5 i++) /* The following is the triple loop*/for (j = 1 j < 5 j++) for (k = 1 k < 5 k++) {if (i! = k & & i! = j & & j! = k) /* ensure i, j, k three distinct*/printf ( " d, d, d \ n" , i, j, k) }}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
classical algorithm c language.doc
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.