結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー merlinmerlin
提出日時 2021-07-30 20:34:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 4,320 ms
コンパイル使用メモリ 72,996 KB
実行使用メモリ 49,648 KB
最終ジャッジ日時 2023-10-14 02:50:20
合計ジャッジ時間 6,151 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,416 KB
testcase_01 AC 44 ms
49,468 KB
testcase_02 AC 44 ms
49,648 KB
testcase_03 AC 44 ms
49,508 KB
testcase_04 AC 45 ms
49,324 KB
testcase_05 AC 44 ms
49,444 KB
testcase_06 AC 44 ms
49,444 KB
testcase_07 AC 44 ms
49,604 KB
testcase_08 AC 44 ms
49,344 KB
testcase_09 AC 43 ms
49,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
        int n=Integer.parseInt(bu.readLine());
        String s[]=bu.readLine().split(" ");
        int i,c[]=new int[9];
        for(i=0;i<9;i++) c[i]=Integer.parseInt(s[i]);

        for(i=8;i>=0 && n>0;i--)
        while(c[i]-->0 && n-->0) sb.append(i+1);
        System.out.print(sb);
    }
}
0