結果

問題 No.83 最大マッチング
ユーザー wf4n9wf4n9
提出日時 2017-10-12 16:33:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 2,212 ms
コンパイル使用メモリ 74,388 KB
実行使用メモリ 41,692 KB
最終ジャッジ日時 2024-04-28 17:04:50
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,512 KB
testcase_01 AC 130 ms
41,456 KB
testcase_02 AC 130 ms
41,232 KB
testcase_03 AC 129 ms
41,100 KB
testcase_04 AC 131 ms
41,200 KB
testcase_05 AC 128 ms
41,616 KB
testcase_06 AC 132 ms
41,344 KB
testcase_07 AC 133 ms
41,576 KB
testcase_08 AC 118 ms
40,092 KB
testcase_09 AC 137 ms
41,284 KB
testcase_10 AC 143 ms
41,396 KB
testcase_11 AC 142 ms
41,692 KB
testcase_12 AC 140 ms
41,552 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