結果

問題 No.83 最大マッチング
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-11 04:35:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 559 bytes
コンパイル時間 2,401 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 42,000 KB
最終ジャッジ日時 2024-04-25 01:34:13
合計ジャッジ時間 4,945 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,100 KB
testcase_01 AC 131 ms
41,280 KB
testcase_02 AC 129 ms
41,156 KB
testcase_03 AC 130 ms
41,232 KB
testcase_04 AC 132 ms
41,160 KB
testcase_05 AC 135 ms
40,988 KB
testcase_06 AC 134 ms
40,840 KB
testcase_07 AC 134 ms
41,520 KB
testcase_08 AC 136 ms
41,136 KB
testcase_09 AC 141 ms
41,312 KB
testcase_10 AC 145 ms
41,444 KB
testcase_11 AC 157 ms
41,652 KB
testcase_12 AC 145 ms
42,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		if (n==2) {System.out.println(1);}
		else if (n==3) {System.out.println(7);}
		else {
			int one = 0;
			int sev = 0;
			if (n%2==0) {
				one = n/2;
				sev = 0;
			}
			else {
				one = n/2-1;
				sev = 1;
			}
			StringBuilder sb = new StringBuilder("");
			for (int i=0; i<sev; i++) {
				sb.append("7");
			}
			for (int i=0; i<one; i++) {
				sb.append("1");
			}
			System.out.println(sb);
		}
	}
}
0