結果
問題 | No.1738 What's in the box? |
ユーザー |
![]() |
提出日時 | 2021-11-12 21:58:06 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 237 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 2,646 ms |
コンパイル使用メモリ | 74,528 KB |
実行使用メモリ | 55,412 KB |
最終ジャッジ日時 | 2024-11-25 18:24:24 |
合計ジャッジ時間 | 16,181 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
ソースコード
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();}}