結果

問題 No.83 最大マッチング
ユーザー Tetsuya OhiraTetsuya Ohira
提出日時 2020-02-10 18:03:15
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 13,656 ms
コンパイル使用メモリ 218,232 KB
実行使用メモリ 10,328 KB
最終ジャッジ日時 2024-04-08 13:07:34
合計ジャッジ時間 12,374 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,676 KB
testcase_05 WA -
testcase_06 AC 1 ms
6,676 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,676 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 150 ms
10,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

// 2 1
// 3 7
// 4 11
// 5 17
// 6 111
// 7 117
// 8 1111
// 9 1117
// 10 11111

// 20 1111111111
func main() {
	var n int
	fmt.Scan(&n)
	// 偶数の場合、2で割った数字ぶん1
	// 奇数の場合、2で割った数字ぶん1+7
	var result string
	if n == 3 {
		result = "7"
	} else if n%2 == 0 {
		// 偶数
		for i := 0; i < n/2; i++ {
			result += "1"
		}
	} else {
		// 奇数
		for i := 0; i < (n-3)/2; i++ {
			result += "1"
		}
		result += "7"
	}
	fmt.Println(result)
}
0