結果
問題 | No.1738 What's in the box? |
ユーザー |
![]() |
提出日時 | 2021-11-12 22:06:33 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 716 bytes |
コンパイル時間 | 2,499 ms |
コンパイル使用メモリ | 76,452 KB |
実行使用メモリ | 51,372 KB |
最終ジャッジ日時 | 2024-11-25 18:47:09 |
合計ジャッジ時間 | 10,908 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 64 WA * 6 |
ソースコード
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,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); } }