Advertisement
matheus_monteiro

nCp

Dec 6th, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int n;
  5.     char s[100];
  6.  
  7.     scanf(" %d", &n);
  8.     scanf(" %s", s);
  9.  
  10.     int cnt = 0;
  11.     for(int a = 0; a < n; ++a)
  12.         for(int b = a + 1; b < n; ++b)
  13.             for(int c = b + 1; c < n; ++c)
  14.                 for(int d = c + 1; d < n; d++)
  15.                     printf("%c %c %c %c\n", s[a], s[b], s[c], s[d]), cnt++;
  16.                
  17.     printf("%d\n", cnt);
  18.  
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement