B.cpp 313 B

123456789101112131415161718192021
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int fact(int n){
  4. return n<=1?1:fact(n-1)*n;
  5. }
  6. int C(int n, int r){
  7. return fact(n)/fact(r)/fact(n-r);
  8. }
  9. int main(){
  10. int n;
  11. cin >> n;
  12. n--;
  13. for(int i = 0; i <= n; i++){
  14. for(int j = 0; j <= i; j++){
  15. cout << C(i, j) << " ";
  16. }
  17. cout << endl;
  18. }
  19. return 0;
  20. }