当前位置:网站首页>Tortoise speed by "template"
Tortoise speed by "template"
2022-07-31 13:48:00 【Qin Xiaoba】
The turtle speed multiplication is used for the multiplication of large numbers, because the multiplication of large numbers will easily explode the range, so the turtle speed multiplication of "safe addition for multiplication, time for space" is adopted.Of course, you can also do not need to ride fast, you can force the conversion of __int128 bits in the place where it is easy to explode.
The code is as follows, the rule is, one multiplier is used as the base, the other is used as the exponent, and the multiplication becomes the addition
# include#include#includeusing namespace std;typedef long long int ll;#define mod 10007ll quick(ll a,ll b){ll sum=0,pow=b;while(pow){if(pow&1)sum=(sum+a)%mod;a=(a+a)%mod;pow>>=1;}return sum%mod;}int main(){int a,b;cin>>a>>b;cout< 边栏推荐
- ADS communicate with c #
- Six Stones Programming: No matter which function you think is useless, people who can use it will not be able to leave, so at least 99%
- 拥塞控制,CDN,端到端
- 页面整屏滚动效果
- C#控件ListView用法
- 一篇文章讲清楚!数据库和数据仓库到底有什么区别和联系?
- The latest complete code: Incremental training using the word2vec pre-training model (two loading methods corresponding to two saving methods) applicable to various versions of gensim
- 技能大赛训练题:交换机虚拟化练习
- 纸质说明书秒变3D动画,斯坦福大学吴佳俊最新研究,入选ECCV 2022
- mysql8, starttime的下一个值作为endtime的上一个值?
猜你喜欢

Spark学习:为Spark Sql添加自定义优化规则

EXCEL如何快速拆分合并单元格数据

图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节

The Selenium IDE of the Selenium test automation

How IDEA runs web programs

Batch大小不一定是2的n次幂!ML资深学者最新结论

PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍

爱可可AI前沿推介(7.31)

一篇文章讲清楚!数据库和数据仓库到底有什么区别和联系?

「面经分享」西北大学 | 字节 生活服务 | 一面二面三面 HR 面
随机推荐
For enterprises in the digital age, data governance is difficult, but it should be done
Samba 远程命令执行漏洞(CVE-2017-7494)
Golang - gin - pprof - use and safety
Comparison of Optical Motion Capture and UWB Positioning Technology in Multi-agent Cooperative Control Research
使用CompletableFuture进行异步处理业务
Shell脚本经典案例:文件的备份
LeetCode·每日一题·1161.最大层内元素和·层次遍历
Open Inventor 10.12 重大改进--和谐版
自制的数据库安全攻防题,相关靶机自己制作
Reasons and solutions for Invalid bound statement (not found)
Six Stones Programming: No matter which function you think is useless, people who can use it will not be able to leave, so at least 99%
【牛客刷题-SQL大厂面试真题】NO3.电商场景(某东商城)
百度网盘安装在c盘显示系统权限限制的解决方法
C# control ListView usage
技能大赛训练题:交换机的远程管理
基于改进YOLOv5的轻量化航空目标检测方法
The importance of strategic offensive capability is much higher than strategic defensive capability
C#使用NumericUpDown控件
hyperf的启动源码分析(二)——请求如何到达控制器
拥塞控制,CDN,端到端