結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー testtest
提出日時 2022-11-21 16:30:45
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 37,576 KB
最終ジャッジ日時 2023-10-22 07:06:07
合計ジャッジ時間 2,441 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
37,576 KB
testcase_01 AC 68 ms
37,576 KB
testcase_02 AC 67 ms
37,576 KB
testcase_03 AC 67 ms
37,576 KB
testcase_04 AC 67 ms
37,576 KB
testcase_05 AC 67 ms
37,576 KB
testcase_06 AC 67 ms
37,576 KB
testcase_07 AC 68 ms
37,576 KB
testcase_08 AC 71 ms
37,576 KB
testcase_09 AC 68 ms
37,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    const src = input.split("\n");
    const arr = src[1].split(" ");
    let ans = "";
    for (let i = 9; i >= 1; i--) {
        let c = parseInt(arr[i - 1]);
        if (c) {
            for (let j = 0; j < c; j++) {
                ans = ans + i;
            }
        }
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0