csuoj 1390: Planting Trees
2013-08-29 08:05
127 查看
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1390
Submit: 192 Solved: 115
[Submit][Status][Web Board]
1390: Planting Trees
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 192 Solved: 115
[Submit][Status][Web Board]
Description
Input
Output
Sample Input
6 39 38 9 35 39 20
Sample Output
42
HINT
Source
AC代码:#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; bool cmp(int a, int b) { return a>b; } int main() { int n, i, k, a[100010]; while(scanf("%d",&n)!=EOF) { for(i=0; i<n; i++) scanf("%d",&a[i]); sort(a, a+n, cmp); k=0; for(i=0; i<n; i++) { k=max(a[i]+i+1, k); } printf("%d\n", k+1); } return 0; }
相关文章推荐
- pku 1390 Blocks(DP)
- CSUOJ 1208-排队
- POJ 1390 Blocks ||UVA 10559 - Blocks(记忆化搜索)
- hdu1390-Binary Numbers
- POJ_1390_Blocks(DP)
- 剑指offer-题目1390:矩形覆盖 (2014.1.5)
- csuoj--1307
- csuoj--1347Last Digit+数学问题
- csuoj 1335: 高桥和低桥
- 题目1390:矩形覆盖
- CSUOJ 1333 Funny Car Racing (spfa算法)
- HDOJ 1390 Binary Numbers(进制问题)
- jzoj 1390. 【2012.02.25普及组】牛车 结题报告
- csuoj 1803: 2016
- 【poj1390】 Blocks
- CSUOJ 1922 Irony Ring 线段树 or 贪心
- csu8月月赛,csuoj1978
- poj1390 Blocks
- CSUOJ 1270 Swap Digits
- [动态规划]Pku1390 Blocks