package main import "fmt" var a, b, k int64 const MOD int64 = 1000000007 func onlyContainAB(s int64) bool {     for s != 0 {         if s%10 != a && s%10 != b {             return false         }         s = s / 10     }     return true } func main() {     fmt.Scan(&a, &b, &k)     combination := int64(1)     ret := int64(0)     for t := int64(1); t <= k; t++ {         combination = (combination * (k - t + 1) / t) % MOD         if onlyContainAB(a*t + (k-t)*b) {             ret = (ret + combination) % MOD         }     }     if onlyContainAB(k * b) {         ret = (ret + 1) % MOD     }     fmt.Println(ret) } 不知道哪错了,明明感觉思路都对的
点赞 评论

相关推荐

牛客网
牛客企业服务