結果

問題 No.83 最大マッチング
ユーザー abcabc
提出日時 2016-11-02 13:02:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 72,200 KB
実行使用メモリ 58,064 KB
最終ジャッジ日時 2023-08-16 12:35:59
合計ジャッジ時間 5,186 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,748 KB
testcase_01 AC 125 ms
55,952 KB
testcase_02 AC 125 ms
58,064 KB
testcase_03 AC 125 ms
55,536 KB
testcase_04 AC 128 ms
55,756 KB
testcase_05 AC 126 ms
55,756 KB
testcase_06 AC 124 ms
56,096 KB
testcase_07 AC 125 ms
55,684 KB
testcase_08 AC 123 ms
55,704 KB
testcase_09 AC 132 ms
55,748 KB
testcase_10 AC 139 ms
55,744 KB
testcase_11 AC 136 ms
55,732 KB
testcase_12 AC 140 ms
55,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int numMatchsticks = sc.nextInt();

        StringBuilder sb = new StringBuilder();

        while (0 < numMatchsticks ) {

            if (numMatchsticks % 2 == 1) {

                sb.append('7');
                numMatchsticks -= 3;

            } else {

                sb.append('1');
                numMatchsticks -= 2;

            }

        }

        System.out.println(sb.toString());

    }

}
0