結果

問題 No.83 最大マッチング
ユーザー fourbetween
提出日時 2019-01-28 19:19:31
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 9,553 ms
コンパイル使用メモリ 233,548 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-05 09:26:56
合計ジャッジ時間 10,219 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
	"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 == 3 {
		return strings.Join([]string{matchNumMemo, "7"}, "")
	}
	return matchNum(int(math.Ceil(float64(leftMatch/2))), strings.Join([]string{matchNumMemo, "1"}, ""))
}
0