結果

問題 No.83 最大マッチング
ユーザー fourbetween
提出日時 2019-01-28 19:30:39
言語 Go
(1.23.4)
結果
AC  
実行時間 938 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 12,828 ms
コンパイル使用メモリ 228,236 KB
実行使用メモリ 40,672 KB
最終ジャッジ日時 2024-10-05 10:14:36
合計ジャッジ時間 12,906 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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