Advertisement
_takumi

3_r3

Mar 15th, 2022
1,190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     int eax, ecx, edx;
  5.     int *esi, *edi;
  6.     int n, k;
  7.     int a[21], b[21];
  8.     scanf("%d%d", &n, &k);
  9.     esi = a;
  10.     edi = b;
  11.     *esi = 1;
  12.     ecx = 0;
  13.     while (ecx != n) {
  14.         ecx++;
  15.         *edi = 1;
  16.         edx = 0;
  17.         while (edx != ecx) {
  18.             edx++;
  19.             *(edi + edx) += *(esi + edx - 1);
  20.         }
  21.         *(edi + edx) = 1;
  22.         int *tmp = esi;
  23.         esi = edi;
  24.         edi = tmp;
  25.     }
  26.     eax = *(esi + k);
  27.     printf("%d\n", eax);
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement