8000 Create 1026.cpp · rinrin528/basic-algo-lecture@74eea52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74eea52

Browse files
Create 1026.cpp
1 parent 55d2a5a commit 74eea52

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

0x11/1026.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// http://boj.kr/266b45d9568a4addbcefad6ac3aec39d
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
int n;
6+
int w[100005];
7+
8+
int main(void){
9+
ios::sync_with_stdio(0);
10+
cin.tie(0);
11+
cin >> n;
12+
for(int i = 0; i < n; i++) cin >> w[i];
13+
sort(w, w+n);
14+
int ans = 0;
15+
for(int i = 1; i <= n; i++)
16+
ans = max(ans, w[n-i]*i);
17+
cout << ans;
18+
}

0 commit comments

Comments
 (0)
0