借书方案

#include <stdio.h>

int main()

{

    int i, j, k, n = 0;

    for (i = 1; i <= 5; i++)

    {

        for (j = 1; j <= 5; j++)

        {

             if (j == i)continue;

             for (k = 1; k <= 5; k++)

             {

                 if (k == j || k == i)continue;

                 printf("%d %d %d  ", i, j, k);

                 n++;

             }

             printf("\n");

        }

        //printf("\n");

    }

    printf("共有%d种借书方法", n);

    return 0;

}

posted @ 2023-04-13 11:04  258333  阅读(15)  评论(1编辑  收藏  举报