18个回答
展开全部
很简单啊
#include<stdio.h>
int main()
{
int i,j,k;
int count = 0;
for(i = 1; i < 5; i++)
{
for(j = 1; j < 5; j++)
{
for(k = 1; k < 5; k++)
{
if(i != k && i != j&& k!= j)
{
printf("%d: %d\n", ++count,(i * 10 + j) * 10 + k);
}
}
}
}
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
能组成24个互不相同且无重复数字的三位数,分别是:123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412,413,421,423,431,432
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 4
struct Node
{
int r[SIZE];
struct Node *next;
} head = {{0}, NULL}, *current = &head;
void swap(int *a, int *b)
{
int t = *a;
*a = *b;
*b = t;
}
void arrange(int m, int n, int *data)
{
//out put a full arrange
if(m == n)
{
struct Node *node = (struct Node *)malloc(sizeof(struct Node));
memcpy(node->r, data, SIZE * sizeof(int));
current->next = node;
current = node;
}
else
{
int i;
for(i = m; i <= n; i++)
{
swap(&data[m], &data[i]);
arrange(m+1, n, data);
swap(&data[m], &data[i]);
}
}
}
int main() {
int data[SIZE] = {1, 2, 3, 4};
arrange(0, 3, data);
struct Node *p;
int count = 0;
for(p = head.next; p; p = p->next) {
printf("%d%d%d\n", p->r[0], p->r[1], p->r[2]);
count++;
}
printf("numbers: %d\n", count);
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-29
展开全部
六个:123,132,213,231,312,321。就这么简单!#include <stdio.h>int main(){ int i,j,k; for(i=1;i<4;i++) for(j=1;j<4;j++) for(k=1;k<4;k++) if(i!=j&&i!=k&&j!=k) printf("%d ",i*100+j*10+k);}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
List<int> number = new List<int>();
for (int i = 1; i <= 4; i++)
{
number.Clear();
number.Add(1);
number.Add(2);
number.Add(3);
number.Add(4);
number.Remove(i);
int a1 = number[0] * 100 + number[1] * 10 + number[2];
int a2 = number[1] * 100 + number[0] * 10 + number[2];
int a5 = number[1] * 100 + number[2] * 10 + number[0];
int a3 = number[0] * 100 + number[2] * 10 + number[1];
int a4 = number[2] * 100 + number[1] * 10 + number[0];
int a6 = number[2] * 100 + number[0] * 10 + number[1];
Console.Write(" " + a1 + " " + a2 + " " + a3 + " " + a4 + " " + a4 + " " + a5 + " " + a6);
for (int i = 1; i <= 4; i++)
{
number.Clear();
number.Add(1);
number.Add(2);
number.Add(3);
number.Add(4);
number.Remove(i);
int a1 = number[0] * 100 + number[1] * 10 + number[2];
int a2 = number[1] * 100 + number[0] * 10 + number[2];
int a5 = number[1] * 100 + number[2] * 10 + number[0];
int a3 = number[0] * 100 + number[2] * 10 + number[1];
int a4 = number[2] * 100 + number[1] * 10 + number[0];
int a6 = number[2] * 100 + number[0] * 10 + number[1];
Console.Write(" " + a1 + " " + a2 + " " + a3 + " " + a4 + " " + a4 + " " + a5 + " " + a6);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询