結果
問題 | No.1738 What's in the box? |
ユーザー |
![]() |
提出日時 | 2021-11-12 22:11:00 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 2,478 ms |
コンパイル使用メモリ | 76,388 KB |
実行使用メモリ | 38,484 KB |
最終ジャッジ日時 | 2024-11-25 19:01:49 |
合計ジャッジ時間 | 10,226 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
ソースコード
import java.io.*;import java.util.*;class Main{public static void main(String args[])throws Exception{BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));StringBuilder sb=new StringBuilder();String s[]=bu.readLine().split(" ");int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]);int a[]=new int[n],i; long tot=0;s=bu.readLine().split(" ");for(i=0;i<n;i++){a[i]=Integer.parseInt(s[i]);tot+=a[i];}for(i=0;i<n;i++){long ans=0;if(a[i]!=0) ans=1l*a[i]*m/tot;sb.append(ans+" ");}System.out.println(sb);}}