肯定是大叔,本来以为用加法做乘法,后来想想这样麻烦,还是可以使用乘法的,按位乘,ov可以看成不止一位,程序如下所示:
#include <stdio.h> #define MAX 40000 int main() {
unsigned int res[MAX];
int n;
int ov, i, j, k;
int pos; while (scanf("%d", &n) != EOF) {
res[] = ;
pos = ; for (i=; i<=n; i++) {
ov = ;
for (j=; j<pos; j++) {
k = res[j] * i + ov;
res[j] = k%;
ov = k / ;
} while (ov) {
res[pos++] = ov % ;
ov /= ;
}
} for (i=pos-; i>=; i--)
printf("%d", res[i]);
printf("\n");
} return ;
}