题意:

就是n复制m次,然后数mod1e9+7;

思路:

案例:31*10^6 + 31*10^4 + 31*10^2 + 31*10^0

所以就是一个等比数列,然后整理一下就是n*(10^(m*len)-1)/(10^len-1),有个除法就是求下逆元,然后飞马小定理,那么答案就是…看代码…

贴一发挫code…

#include <bits/stdc++.h>
#include<algorithm>
using namespace std; typedef __int64 LL;
const LL mod=1e9+7; LL cal(LL x,LL g)
{
LL ans=1;
while(g)
{
if(g%2) ans=(ans*x)%mod;
x=(x*x)%mod;
g/=2;
}
return ans;
} LL getlen(LL x)
{
LL ans=0;
while(x)
{
ans++;
x/=10;
}
return ans;
} LL rev(int x)
{
return cal(x,mod-2);
} int main()
{
int T;
LL n,m;
scanf("%d",&T);
while(T--)
{
scanf("%I64d%I64d",&m,&n);
printf("%I64d\n",n*(cal(10,getlen(n)*m)-1)%mod*rev(cal(10,getlen(n))-1)%mod);
}
return 0;
}

Codeforces gym 101061 G【递推公式+逆元】的更多相关文章

  1. Codeforces Gym 100513G G. FacePalm Accounting

    G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...

  2. Codeforces Gym 100637G G. #TheDress 暴力

    G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...

  3. Codeforces Gym 100513G G. FacePalm Accounting 暴力

    G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...

  4. Codeforces Gym 101138 G. LCM-er

    Description 在 \([a,b]\) 之间选择 \(n\) 个数 (可以重复) ,使这 \(n\) 个数的最小公倍数能被 \(x\) 整除,对 \(10^9+7\) 取膜. \(1\leqs ...

  5. Codeforces Gym 100203G G - Good elements 标记暴力

    G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  6. Codeforces Gym 100203G G - Good elements 暴力

    G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  7. Codeforces Gym 101142 G Gangsters in Central City (lca+dfs序+树状数组+set)

    题意: 树的根节点为水源,编号为 1 .给定编号为 2, 3, 4, …, n 的点的父节点.已知只有叶子节点都是房子. 有 q 个操作,每个操作可以是下列两者之一: + v ,表示编号为 v 的房子 ...

  8. Codeforces Gym 101190M Mole Tunnels - 费用流

    题目传送门 传送门 题目大意 $m$只鼹鼠有$n$个巢穴,$n - 1$条长度为$1$的通道将它们连通且第$i(i > 1)$个巢穴与第$\left\lfloor \frac{i}{2}\rig ...

  9. Codeforces Gym 101623A - 动态规划

    题目传送门 传送门 题目大意 给定一个长度为$n$的序列,要求划分成最少的段数,然后将这些段排序使得新序列单调不减. 考虑将相邻的相等的数缩成一个数. 假设没有分成了$n$段,考虑最少能够减少多少划分 ...

随机推荐

  1. SpringCloud中Rabbitmq的使用

    1.pom配置,添加以来jar包 <dependency> <groupId>org.springframework.cloud</groupId> <art ...

  2. 使用azure send grid发送email

    1. create a send grid account 2. remember the username/password of the send grid account watermark/2 ...

  3. 三期_day05_Dao层的准备工作_II

    工作文件夹: 实体类:UserInfo.java package com.yc.crm.entity; import java.util.Date; public class UserInfo { p ...

  4. poj 1659 Frogs&#39; Neighborhood 度序列可图化 贪心

    题意: 对一个无向图给出一个度序列,问他是否可简单图化. 分析: 依据Havel定理,直接贪心就可以. 代码: //poj 1659 //sep9 #include <iostream> ...

  5. js正則表達式:验证邮箱格式、password复杂度、手机号码、QQ号码

    $(function () { $("input[name='sub']").on("click", function () { if (!isEmail($( ...

  6. 将世界坐标转成NGUI坐标

    将世界坐标转成NGUI坐标,这个中间须要一个屏幕坐标,可參考例如以下代码: /// <summary> /// 将世界坐标转成UI坐标 /// </summary> /// & ...

  7. css设置背景图片自适应

      CreateTime--2017年12月25日16:36:07 Author:Marydon 控制背景图片100%自适应填充布局 /* 控制背景图片100%自适应填充布局 */ body{ bac ...

  8. ORA-07445 第一參数为:kkqljpmpr

      在版本号11.2.0.1.0上,在pl/sql developer中运行一条SQL会导致连接中断,这样的错误要到trace文件夹下找到错误日志文件,再定位.查了一下资料,是这个版本号的bug. D ...

  9. redis中关于过期键的删除策略

    我们已经了解到了Redis是一种内存数据库,Redis中数据都是以key-value的形式存储在内存中.由Redisserver来维护和管理这部分内存,内存是何足珍贵,不须要的数据或者是已经使用过的无 ...

  10. Struts2的配置文件——web.xml

    任何MVC框架都需要与Web应用整合,这就不得不借助于web.xml文件,只有配置在web.xml文件中Servlet才会被应用加载. 通常,所有的MVC框架都需要Web应用加载一个核心控制器,对于S ...