안선생의 개발 블로그
C++ 11399 ATM 본문
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <iostream>
#include <string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<vector>
using namespace std;
int main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int n; cin >> n;
vector<int> a(n);
while (n--)
cin >> a[n];
sort(a.begin(), a.end());
int result = 0;
int sum = 0;
for (int i = 0; i < a.size(); i++)
{
result += a[i];
sum += result;
}
cout << sum;
return 0;
}
|
cs |
https://www.acmicpc.net/problem/11399
11399번: ATM
첫째 줄에 사람의 수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어진다. (1 ≤ Pi ≤ 1,000)
www.acmicpc.net
'백준' 카테고리의 다른 글
C++ 13305 주요소 (0) | 2023.02.10 |
---|---|
C++ 13305 잃어버린 괄호 (0) | 2023.02.10 |
C++ 11047 동전 (0) | 2023.02.10 |
백준 11899 괄호 끼워넣기 (0) | 2023.02.09 |
백준 17608번 막대기 (0) | 2023.02.09 |