結果

問題 No.1738 What's in the box?
ユーザー ripityripity
提出日時 2021-11-12 21:58:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 4,357 ms
コンパイル使用メモリ 72,100 KB
実行使用メモリ 57,596 KB
最終ジャッジ日時 2023-08-17 01:20:37
合計ジャッジ時間 18,944 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,620 KB
testcase_01 AC 129 ms
55,944 KB
testcase_02 AC 130 ms
55,672 KB
testcase_03 AC 248 ms
57,248 KB
testcase_04 AC 243 ms
57,596 KB
testcase_05 AC 240 ms
57,168 KB
testcase_06 AC 246 ms
56,820 KB
testcase_07 AC 246 ms
57,320 KB
testcase_08 AC 240 ms
57,188 KB
testcase_09 AC 252 ms
56,860 KB
testcase_10 AC 239 ms
57,268 KB
testcase_11 AC 250 ms
57,016 KB
testcase_12 AC 239 ms
56,936 KB
testcase_13 AC 135 ms
55,852 KB
testcase_14 AC 135 ms
53,652 KB
testcase_15 AC 130 ms
55,508 KB
testcase_16 AC 140 ms
55,552 KB
testcase_17 AC 139 ms
55,672 KB
testcase_18 AC 131 ms
55,616 KB
testcase_19 AC 137 ms
55,728 KB
testcase_20 AC 136 ms
55,884 KB
testcase_21 AC 156 ms
55,772 KB
testcase_22 AC 140 ms
55,460 KB
testcase_23 AC 131 ms
55,544 KB
testcase_24 AC 178 ms
56,124 KB
testcase_25 AC 175 ms
56,052 KB
testcase_26 AC 132 ms
55,572 KB
testcase_27 AC 131 ms
55,572 KB
testcase_28 AC 137 ms
55,648 KB
testcase_29 AC 134 ms
55,928 KB
testcase_30 AC 127 ms
55,468 KB
testcase_31 AC 152 ms
55,976 KB
testcase_32 AC 167 ms
55,748 KB
testcase_33 AC 232 ms
56,936 KB
testcase_34 AC 242 ms
57,216 KB
testcase_35 AC 239 ms
56,844 KB
testcase_36 AC 245 ms
57,468 KB
testcase_37 AC 236 ms
57,012 KB
testcase_38 AC 240 ms
57,152 KB
testcase_39 AC 246 ms
57,200 KB
testcase_40 AC 251 ms
57,012 KB
testcase_41 AC 247 ms
57,024 KB
testcase_42 AC 240 ms
57,332 KB
testcase_43 AC 244 ms
56,668 KB
testcase_44 AC 251 ms
56,832 KB
testcase_45 AC 250 ms
57,192 KB
testcase_46 AC 253 ms
56,916 KB
testcase_47 AC 249 ms
56,784 KB
testcase_48 AC 254 ms
57,056 KB
testcase_49 AC 248 ms
56,892 KB
testcase_50 AC 240 ms
56,672 KB
testcase_51 AC 242 ms
57,048 KB
testcase_52 AC 238 ms
56,912 KB
testcase_53 AC 128 ms
55,756 KB
testcase_54 AC 127 ms
55,652 KB
testcase_55 AC 129 ms
55,696 KB
testcase_56 AC 152 ms
55,616 KB
testcase_57 AC 129 ms
55,616 KB
testcase_58 AC 131 ms
53,616 KB
testcase_59 AC 129 ms
55,852 KB
testcase_60 AC 131 ms
55,720 KB
testcase_61 AC 129 ms
55,776 KB
testcase_62 AC 130 ms
55,668 KB
testcase_63 AC 131 ms
55,808 KB
testcase_64 AC 128 ms
55,556 KB
testcase_65 AC 129 ms
55,940 KB
testcase_66 AC 130 ms
55,548 KB
testcase_67 AC 129 ms
55,884 KB
testcase_68 AC 130 ms
55,856 KB
testcase_69 AC 129 ms
55,624 KB
testcase_70 AC 131 ms
55,464 KB
testcase_71 AC 129 ms
55,484 KB
testcase_72 AC 129 ms
55,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        long M = sc.nextInt();
        long[] W = new long[(int)N];
        long wsum = 0;
        for( int i = 0; i < N; i++ ) {
            W[i] = sc.nextInt();
            wsum += W[i];
        }
        
        for( int i = 0; i < N; i++ ) {
            System.out.print( wsum == 0 ? 0 : (M*W[i])/wsum );
            if( i < N-1 ) System.out.print(" ");
        }
        
        System.out.println();
        
    }
    
}
0