Train problem IITime
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 6454 Accepted Submission (s): 3514
Problem Descriptionas We all know the Train problem I, the boss of the Ignatius Train station want to know if all the Trai NS come in strict-increasing order, "How many orders," all the trains can get out of the railway.
Inputthe input contains several test cases. Each test cases consists of a number N (1<=n<=100). The input is terminated by the end of file.
Outputfor Each test case, you should output "How many ways", the trains can get out of the railway.
Sample Input
12310
Sample Output
12516796HintThe result would be very large and so could not process it by 32-bit integers.
Cattleya number: Baidu Encyclopedia code:
#include <stdio.h>int cat[110][100]; int main () {int n; cat[0][0] = cat[1][0] = 1; cat[0][1] = cat[1][1] = 1; for (int i = 2; I <= 100; ++i) {for (int j = 1; J <= Cat[i-1][0]; ++j) {Cat[i][j] = cat[i-1][j]* (4*i-2);} int temp = 0, Len = 1;for (len = 1; len <= cat[i-1][0]; ++len) {Cat[i][len] + = temp; temp = CAT[I][LEN]/10; Cat[i][len ]%= 10; }while (temp! = 0) {cat[i][len++] + = temp%10; temp/= 10;} for (int j = len-1, r = 0; j > 0;--j) {temp = R*10+cat[i][j]; r = temp% (i+1); Cat[i][j] = temp/(i+1);} while (cat[i][len] = = 0) {--len;} Cat[i][0] = len;} while (~SCANF ("%d", &n)) {for (int i = cat[n][0]; i > 0; i) printf ("%d", Cat[n][i]);p UTS (""); return 0;}
with June
HDU 1023 Train Problem II applies to large number multiplication + large number Division + Cattleya number