博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CodeForces 300C 最短路
阅读量:7092 次
发布时间:2019-06-28

本文共 1398 字,大约阅读时间需要 4 分钟。

A
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u
Submit     

Description

Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if the sum of its digits is a good number.

For example, let's say that Vitaly's favourite digits are 1 and 3, then number 12 isn't good and numbers 13 or 311 are. Also, number111 is excellent and number 11 isn't.

Now Vitaly is wondering, how many excellent numbers of length exactly n are there. As this number can be rather large, he asks you to count the remainder after dividing it by 1000000007(109 + 7).

A number's length is the number of digits in its decimal representation without leading zeroes.

Input

The first line contains three integers: abn(1 ≤ a < b ≤ 9, 1 ≤ n ≤ 106).

Output

Print a single integer — the answer to the problem modulo 1000000007(109 + 7).

Sample Input

Input
1 3 3
Output
1
Input
2 3 10
Output
165
#include
#include
#include
using namespace std;struct Node{ int x,y;} sta[100005];int map[105][105];int main(){ int n,d; int tim[100005]; scanf("%d%d",&n,&d); for(int i=2; i<=n-1; i++) scanf("%d",&tim[i]); for(int i=1; i
View Code

 

转载地址:http://vbiql.baihongyu.com/

你可能感兴趣的文章
日剧·日综资源集合(建议收藏)
查看>>
[译]go错误处理
查看>>
彩铅练习,樱桃
查看>>
yum 找不到程序, yum更换国内阿里源
查看>>
快速排序
查看>>
tomcat 、springboot远程调试
查看>>
1-AI--Activity生命周期
查看>>
SpringBoot集成RabbitMQ
查看>>
Ubuntu 14.04 将于4月30日停止支持,但可以购买“延保”
查看>>
Facebook 开源了一整套重要的 Linux 内核组件与工具!
查看>>
回顾互联网的过去十年(下)
查看>>
Spring AOP不拦截从对象内部调用的方法原因
查看>>
JSON.parse()和JSON.stringify()
查看>>
Github上如何在组织中的代码仓库里,为组织中的小组创建Pull Request(拉取请求/下载请求)?...
查看>>
Feign 与 Hystrix
查看>>
MongoDB之分片集群(Sharding)
查看>>
阿里巴巴的AI算法程序媛是怎样的一种存在?
查看>>
Pygame常用方法
查看>>
java基础学习_概述_day01总结
查看>>
新旧之争,JDK 团队发起 Project Skara 引争议
查看>>