結果

問題 No.83 最大マッチング
ユーザー fourbetweenfourbetween
提出日時 2019-01-28 19:30:39
言語 Go
(1.22.1)
結果
AC  
実行時間 1,092 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 15,146 ms
コンパイル使用メモリ 232,432 KB
実行使用メモリ 30,336 KB
最終ジャッジ日時 2024-04-15 13:34:39
合計ジャッジ時間 17,633 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 9 ms
7,936 KB
testcase_10 AC 481 ms
15,516 KB
testcase_11 AC 1,092 ms
18,840 KB
testcase_12 AC 1,085 ms
30,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(matchNum(n, ""))
}

func matchNum(leftMatch int, matchNumMemo string) string {
	if leftMatch < 2 {
		return matchNumMemo
	}
	if leftMatch == 2 {
		return strings.Join([]string{matchNumMemo, "1"}, "")
	}
	if leftMatch%2 == 1 {
		return matchNum(leftMatch-3, strings.Join([]string{matchNumMemo, "7"}, ""))
	}
	return matchNum(leftMatch-2, strings.Join([]string{matchNumMemo, "1"}, ""))
}
0