因为这里是MOD最大为100000

所以我将字符串看作5个一组,并记录后面跟了多少个100000

每次取5个数根据其数据进行取模更新

注意过程中 100000*100000会超int

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define ll long long
int b;
char s[]; int main()
{
// freopen("a.in" , "r" , stdin);
while(~scanf("%s%d" , s , &b))
{
int len = strlen(s);
int p = len- , t = ; //t表示后面要乘几次100000
int cur = ;
while(p >= ){
ll num = , mul = ;
for(int i = ; i<&&p>= ; i++){
num += mul * (s[p] - '');
mul *= ;
p--;
}
// cout<<"num: "<<num<<endl;
num = num % b;
for(int i = ; i<=t ; i++){
num *= ;
num %= b;
}
num += cur;
num %= b;
cur = num;
t++;
}
printf("%d\n" , cur);
}
return ;
}

最新文章

  1. qt5.5程序打包发布以及依赖【转】
  2. iOS10 拍照崩溃问题
  3. 在VC++6.0开发中实现全屏显示
  4. 错误解决:SharePoint Designer 2010编辑后,出现数据源控件未能执行插入命令,data source control failed to execute the insert command
  5. Activiti 学习笔记记录(二)
  6. SQL Server配置管理器”远程过程调用失败“的问题解决
  7. Spring整合Hibernate。。。。
  8. wcf通过webHttpBinding方式发布rest web服务
  9. 如何利用花生壳和VisualSVN Server建立远程代码仓库
  10. python 传入参数返回的时候好像有些时候会出现莫名其妙的循环
  11. POJ 1166 The Clocks
  12. 转:如何在 LoadRunner 脚本中做关联 (Correlation)
  13. C# WebSocket Fleck 调用非托管C++ DLL 实现通信(使用stringbuilder接收)
  14. Jenkins持续集成介绍及插件安装版本更新演示(一)--技术流ken
  15. c# 数据存储过程
  16. Deep Reinforcement Learning for Visual Object Tracking in Videos 论文笔记
  17. kendo-ui表单验证
  18. 如何去除WIN7任务栏项目上右键菜单中的最近访问一栏
  19. Intro to Python for Data Science Learning 7 - 2D NumPy Arrays
  20. 导出 java.io.IOException: 权限不够

热门文章

  1. codehunter 「Adera 6」杯省选模拟赛 网络升级 【树形dp】
  2. bzoj1015星球大战(并查集+离线)
  3. typescript进阶篇之高级类型与条件类型(Readonly, Partial, Pick, Record)
  4. less新手入门(四)—— Mixin Guards
  5. [读书笔记2]《C语言嵌入式系统编程修炼》
  6. HDU 4691 后缀数组+RMQ
  7. EditText(2)自定义回车键的行为
  8. 【[转】MySql模糊查询
  9. [转]ASP.NET MVC中实现多个按钮提交的几种方法
  10. visual studio 2015安装