题意:中文题
思路:逐点累加法
7183388 | 2012-11-17 21:21:31 | Accepted | 2067 | 0MS | 284K | 407 B | C++ | 罗维 |
View Code
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 __int64 map[40][40]; //int64伤不起 7 int n, i, j; 8 int t=1; 9 while (scanf("%d",&n) && n!=-1) 10 { 11 memset(map, 0, sizeof(map)); 12 for (j=0; j<=n; j++) 13 map[0][j] = 1; 14 15 for (i=1; i<=n; i++) 16 { 17 for (j=i; j<=n; j++) 18 { 19 map[i][j] = map[i-1][j] + map[i][j-1]; 20 } 21 } 22 printf("%d %d %I64d\n",t++, n, 2*map[n][n]); 23 } 24 return 0; 25 }