結果

問題 No.793 うし数列 2
ユーザー tsuchinagatsuchinaga
提出日時 2019-05-09 18:13:33
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 556 bytes
コンパイル時間 12,423 ms
コンパイル使用メモリ 211,356 KB
実行使用メモリ 7,740 KB
最終ジャッジ日時 2023-09-14 17:45:24
合計ジャッジ時間 17,713 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 15 ms
4,376 KB
testcase_06 AC 94 ms
5,684 KB
testcase_07 AC 31 ms
5,652 KB
testcase_08 AC 107 ms
7,740 KB
testcase_09 AC 51 ms
5,668 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
	"math/big"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)

	mod := int64(math.Pow10(9)) + 7
	bi := Pow10Mod793(n)
	bi.Mul(bi, big.NewInt(12))
	bi.Sub(bi, big.NewInt(12))
	bi.Div(bi, big.NewInt(9))
	bi.Add(bi, big.NewInt(1))
	bi.Mod(bi, big.NewInt(mod))

	fmt.Println(bi.Int64())
}

func Pow10Mod793(n int) *big.Int {
	if n <= 1 {
		return big.NewInt(10)
	} else if n%2 == 1 {
		bi := Pow10Mod793(n - 1)
		bi.Mul(bi, big.NewInt(10))
		return bi
	} else {
		bi := Pow10Mod793(n / 2)
		bi.Mul(bi, bi)
		return bi
	}
}
0