VioletaBabel

2217번: 로프 본문

백준/백준-C++
2217번: 로프
Beabletoet 2018. 3. 20. 15:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
    int nNum[100001], n, max = 0;
    scanf("%d"&n);
    for (int i = 0; i < n; ++i)
        scanf("%d", nNum + i);
    sort(nNum, nNum + n, greater<int>());
    for (int i = 0; i < n; ++i)
        max = (max < nNum[i] * (i + 1)) ? nNum[i] * (i + 1) : max;
    printf("%d", max);
}
cs


'백준 > 백준-C++' 카테고리의 다른 글

1021번: 회전하는 큐  (0) 2018.12.04
1003번: 피보나치 함수  (0) 2018.06.26
4641번: Doubles  (0) 2018.03.15
1748번: 수 이어 쓰기 1  (0) 2018.03.15
1966번: 프린터 큐  (0) 2018.03.15
Comments