// Level 3
#include <stdio.h>
int combi(int n, int r)
{
int i, s = 1;
for (i = n; i >= r + 1; i--) {
s *= i;
}
for (i = n - r; i >= 2; i--) {
s /= i;
}
return s;
}
int main()
{
int n, r;
for (n = 0; n <= 5; n++) {
for (r = 0; r <= n; r++) {
printf("%dC%d= %-3d", n
, r
, combi
(n
, r
)); }
}
return 0;
}
Ly8gTGV2ZWwgMwojaW5jbHVkZSA8c3RkaW8uaD4KCmludCBjb21iaShpbnQgbiwgaW50IHIpCnsKICAgIGludCBpLCBzID0gMTsKICAgIGZvciAoaSA9IG47IGkgPj0gciArIDE7IGktLSkgewogICAgICAgIHMgKj0gaTsKICAgIH0KICAgIGZvciAoaSA9IG4gLSByOyBpID49IDI7IGktLSkgewogICAgICAgIHMgLz0gaTsKICAgIH0KICAgIHJldHVybiBzOwp9CgppbnQgbWFpbigpCnsKICAgIGludCBuLCByOwoKICAgIGZvciAobiA9IDA7IG4gPD0gNTsgbisrKSB7CiAgICAgICAgZm9yIChyID0gMDsgciA8PSBuOyByKyspIHsKICAgICAgICAgICAgcHJpbnRmKCIlZEMlZD0gJS0zZCIsIG4sIHIsIGNvbWJpKG4sIHIpKTsKICAgICAgICB9CiAgICAgICAgcHJpbnRmKCJcbiIpOwogICAgfQogICAgcmV0dXJuIDA7Cn0K