結果

問題 No.549 素材合成システム
ユーザー tentententen
提出日時 2023-07-27 17:23:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 1,758 bytes
コンパイル時間 2,474 ms
コンパイル使用メモリ 90,328 KB
実行使用メモリ 58,812 KB
最終ジャッジ日時 2024-04-15 04:30:31
合計ジャッジ時間 12,085 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
50,500 KB
testcase_01 AC 50 ms
50,524 KB
testcase_02 AC 49 ms
50,260 KB
testcase_03 AC 49 ms
49,936 KB
testcase_04 AC 51 ms
50,548 KB
testcase_05 AC 49 ms
50,208 KB
testcase_06 AC 49 ms
50,464 KB
testcase_07 AC 252 ms
56,916 KB
testcase_08 AC 276 ms
56,500 KB
testcase_09 AC 279 ms
56,708 KB
testcase_10 AC 282 ms
56,636 KB
testcase_11 AC 260 ms
56,680 KB
testcase_12 AC 287 ms
56,512 KB
testcase_13 AC 279 ms
56,556 KB
testcase_14 AC 300 ms
56,568 KB
testcase_15 AC 249 ms
56,400 KB
testcase_16 AC 287 ms
56,552 KB
testcase_17 AC 170 ms
55,888 KB
testcase_18 AC 175 ms
56,416 KB
testcase_19 AC 182 ms
56,396 KB
testcase_20 AC 172 ms
56,448 KB
testcase_21 AC 201 ms
56,248 KB
testcase_22 AC 208 ms
58,812 KB
testcase_23 AC 203 ms
56,248 KB
testcase_24 AC 266 ms
58,716 KB
testcase_25 AC 266 ms
58,608 KB
testcase_26 AC 267 ms
56,776 KB
testcase_27 AC 278 ms
56,788 KB
testcase_28 AC 50 ms
50,304 KB
testcase_29 AC 51 ms
50,504 KB
testcase_30 AC 50 ms
50,148 KB
testcase_31 AC 193 ms
56,708 KB
testcase_32 AC 189 ms
56,852 KB
testcase_33 AC 190 ms
56,660 KB
testcase_34 AC 193 ms
56,668 KB
testcase_35 AC 211 ms
56,216 KB
testcase_36 AC 205 ms
56,760 KB
testcase_37 AC 222 ms
56,384 KB
testcase_38 AC 50 ms
50,452 KB
testcase_39 AC 51 ms
50,504 KB
testcase_40 AC 222 ms
56,192 KB
testcase_41 AC 158 ms
54,980 KB
testcase_42 AC 85 ms
51,356 KB
testcase_43 AC 130 ms
54,320 KB
testcase_44 AC 92 ms
52,096 KB
testcase_45 AC 128 ms
55,096 KB
testcase_46 AC 113 ms
52,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            queue.add(sc.nextInt());
        }
        long ans = 0;
        while (queue.size() > 1) {
            ans += queue.poll() / 2;
        }
        ans += queue.poll();
        System.out.println(ans);
    }
} 
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0