当前位置:网站首页>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< 边栏推荐
- 技能大赛dhcp服务训练题
- 使用CompletableFuture进行异步处理业务
- 机器学习模型验证:被低估的重要一环
- SetoolKit使用指南
- The Selenium IDE of the Selenium test automation
- [Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
- 232层3D闪存芯片来了:单片容量2TB,传输速度提高50%
- 战略进攻能力的重要性,要远远高于战略防守能力
- endnote引用
- MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
猜你喜欢

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

技能大赛训练题:交换机的远程管理

Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"

Selenium自动化测试之Selenium IDE

【牛客刷题-SQL大厂面试真题】NO3.电商场景(某东商城)

ECCV 2022 | 机器人的交互感知与物体操作

操作符详解

Install the latest pytorch gpu version

How IDEA runs web programs

Error: npm ERR code EPERM
随机推荐
【redis】发布和订阅消息
最新完整代码:使用word2vec预训练模型进行增量训练(两种保存方式对应的两种加载方式)适用gensim各种版本
对数字化时代的企业来说,数据治理难做,但应该去做
ECCV 2022 | Robotic Interaction Perception and Object Manipulation
Selenium自动化测试之Selenium IDE
滑窗法切分数据
C#控件CheckBox的使用
网络层重点协议——IP协议
深度剖析 Apache EventMesh 云原生分布式事件驱动架构
LeetCode·每日一题·1161.最大层内元素和·层次遍历
C# List用法 List介绍
LeetCode rotate array
20.nn.Module
技能大赛训练题:交换机虚拟化练习
八大排序汇总及其稳定性
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
IDEA can't find the Database solution
leetcode: 485. Maximum number of consecutive 1s
Buffer 与 拥塞控制
A detailed explanation of the usage of Async and Await in C#