結果

問題 No.741 AscNumber(Easy)
ユーザー tsuchinaga
提出日時 2019-05-21 12:36:57
言語 Go
(1.23.4)
結果
AC  
実行時間 971 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 12,972 ms
コンパイル使用メモリ 228,508 KB
実行使用メモリ 8,200 KB
最終ジャッジ日時 2024-09-17 08:55:08
合計ジャッジ時間 25,012 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

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

	mod := int(math.Pow10(9)) + 7
	nums := map[int]int{1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1}
	ans := 10
	for i := 2; i <= n; i++ {
		total := 0
		tmp := make(map[int]int)
		for j := 9; j >= 1; j-- {
			total = (total + nums[j]) % mod
			tmp[j] = total
			ans = (ans + total) % mod
		}
		nums = tmp
	}
	fmt.Println(ans)
}
0