We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5422eed commit 6ca3d4aCopy full SHA for 6ca3d4a
1 file changed
정건우/6주차/260202.java
@@ -0,0 +1,33 @@
1
+//https://www.acmicpc.net/problem/12845
2
+import java.io.BufferedReader;
3
+import java.io.IOException;
4
+import java.io.InputStreamReader;
5
+import java.util.StringTokenizer;
6
+
7
+public class BOJ_S3_12845_모두의마블 {
8
+ public static void main(String[] args) throws IOException {
9
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
10
11
+ int N = Integer.parseInt(br.readLine());
12
+ int [] cards = new int[N];
13
+ int ans = 0;
14
15
+ int max = -1;
16
17
+ StringTokenizer st = new StringTokenizer(br.readLine());
18
+ for (int i = 0; i < N; i++) {
19
+ cards[i] = Integer.parseInt(st.nextToken());
20
+ ans += cards[i];
21
22
+ if(cards[i] > max) {
23
+ max = cards[i];
24
+ }
25
26
27
+ ans -= max;
28
+ ans += (max * (N-1));
29
30
+ System.out.println(ans);
31
32
33
+}
0 commit comments