小明有5本新书,要借给A,B,C这三位小朋友,若每次每人只能借一本,则可以有多少种不同的借法?
直接输代码
#include<iostream> using namespace std; int main() { int a = 0, b = 0, c = 0; for (int a = 1; a <=5 ; a++) { for (int b = 1; b <= 5; b++) { for (int c = 1; c <= 5; c++) { if (a != b && a != c && b != c) cout << a << " " << b << " " << c << " " << endl; } } } return 0; }
标签:方案,int,借法,namespace,知多少,借书,include From: https://www.cnblogs.com/lllyclh/p/17326844.html