結果

問題 No.83 最大マッチング
ユーザー wf4n9wf4n9
提出日時 2017-10-12 16:33:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 72,220 KB
実行使用メモリ 56,408 KB
最終ジャッジ日時 2023-08-10 23:56:49
合計ジャッジ時間 4,281 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,768 KB
testcase_01 AC 118 ms
55,956 KB
testcase_02 AC 117 ms
55,760 KB
testcase_03 AC 119 ms
56,284 KB
testcase_04 AC 119 ms
55,848 KB
testcase_05 AC 119 ms
55,916 KB
testcase_06 AC 120 ms
55,760 KB
testcase_07 AC 119 ms
55,992 KB
testcase_08 AC 119 ms
55,780 KB
testcase_09 AC 129 ms
56,156 KB
testcase_10 AC 130 ms
56,408 KB
testcase_11 AC 132 ms
55,744 KB
testcase_12 AC 132 ms
55,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int matchQty = sc.nextInt();
		System.out.println(matchNum(matchQty));
	}

	public static String matchNum(int matchQty) {


		StringBuilder sb = new StringBuilder("");
		if (matchQty % 2 == 0) {
			for (int i = 0; i < matchQty / 2; i++) {
				sb.append("1");
			}
		} else {
			sb.append("7");
			matchQty -= 3;
			for (int i = 0; i < matchQty / 2; i++) {
				sb.append("1");
			}
		}
		return sb.toString();

	}
}
0