Codeforces Round #289 (Div. 2, ACM ICPC Rules) -- A. Maximum in Table
来源:互联网 发布:java插件下载 编辑:程序博客网 时间:2024/05/18 02:36
A. Maximum in Table
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputAn n × n table a is defined as follows:
- The first row and the first column contain ones, that is: ai, 1 = a1, i = 1 for all i = 1, 2, ..., n.
- Each of the remaining numbers in the table is equal to the sum of the number above it and the number to the left of it. In other words, the remaining elements are defined by the formula ai, j = ai - 1, j + ai, j - 1.
These conditions define all the values in the table.
You are given a number n. You need to determine the maximum value in the n × n table defined by the rules above.
Input
The only line of input contains a positive integer n (1 ≤ n ≤ 10) — the number of rows and columns of the table.
Output
Print a single line containing a positive integer m — the maximum value in the table.
Sample test(s)
input
1
output
1
input
5
output
70
Note
In the second test the rows of the table look as follows:
水题,,做来耍耍。。
AC代码:
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int a[15][15];int main() {for(int i = 1; i < 11; i++) {a[i][1] = 1; a[1][i] = 1;}for(int i = 2; i < 11; i++) {for(int j = 2; j < 11; j++) {a[i][j] = a[i-1][j] + a[i][j-1];}}int n;while(scanf("%d", &n) != EOF) {printf("%d\n", a[n][n]);}}
1 1
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) -- A. Maximum in Table
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)(A,B)
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)C、E
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) C题
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) 部分题解
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) (A, B, C, E)
- Codeforces Round #145 (Div. 1, ACM-ICPC Rules)A
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) D - Name
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) E - Cubes
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules) C - Letter
- Codeforces Round #145 (Div. 2, ACM-ICPC Rules)
- Codeforces Round #145 (Div. 2, ACM-ICPC Rules) Fence
- Codeforces Round #145 (Div. 2, ACM-ICPC Rules)
- Codeforces Round #116 (Div. 2, ACM-ICPC Rules)---E. Cubes
- QML与C++混合编程使用
- USACO6.5.3 Betsy's Tour(betsy)
- 关于ASP.NET用VS2012出现数据库内容汉字乱码(中文乱码)或者汉字变问号(中文变问号)的解决办法,非常简单。
- 黑马程序员----OC核心语法
- CentOS下多节点Openstack安装(四)—— Nova安装
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) -- A. Maximum in Table
- Unity3D中对象池的使用
- 程序员注定孤独
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) -- B. Painting Pebbles (贪心)
- USACO6.5.4 The Clocks(clocks)
- iPhone中使用NSLocalizedString实现国际化
- 协程(coroutine)
- HDU 5099 Comparison of Android versions(坑水题)
- 黑马程序员----OC三大特征