結果

問題 No.2947 Sing a Song
ユーザー anago-pie
提出日時 2024-10-31 17:05:39
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 574 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 7,204 KB
実行使用メモリ 47,152 KB
最終ジャッジ日時 2024-10-31 17:05:48
合計ジャッジ時間 8,454 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(INPUT){
  const input=INPUT.split("\n");
  const N=parseInt(input[0]);
  const [S,T]=input[1].split(" ");
  const [s,t]=[S.length,T.length];
  const A=input[2].split(" ").map(_=>parseInt(_));
  for(let i=0;i<N;i++){
    for(let j=0;j<=A[i];j++){
      let k=A[i]-t*j;
      if(k%s==0){
        console.log(Array(j+k/s).fill().map((_,id)=>id<j?T:S).join(" "));
        break;
      }
    }
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0