結果
| 問題 |
No.1738 What's in the box?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-27 17:59:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 484 bytes |
| コンパイル時間 | 1,921 ms |
| コンパイル使用メモリ | 196,304 KB |
| 最終ジャッジ日時 | 2025-02-07 17:22:03 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 70 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
if(M==0){
for(int i=0;i<N;i++)cout<<0<<(i==N-1?'\n':' ');
return 0;
}
vector<int>A(N);
for(int &i:A)cin>>i;
int u=0;
for(int i:A)u=gcd(u,i);
vector<int>ans(N);
int s=0;
for(int i=0;i<N;i++){
ans[i]=A[i]/u;
s+=ans[i];
}
for(int i=0;i<N;i++){
cout<<ans[i]*(M/s)<<(i==N-1?'\n':' ');
}
}