当前位置:网站首页>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< 边栏推荐
- Install the latest pytorch gpu version
- Save and load numpy matrices and vectors, and use the saved vectors for similarity calculation
- LeetCode旋转数组
- Unity study notes Description of AVPro video jump function (Seeking)
- endnote引用
- 拥塞控制,CDN,端到端
- 1-hour live broadcast recruitment order: industry leaders share dry goods, and enterprise registration is open丨qubit · point of view
- AWS implements scheduled tasks - Lambda+EventBridge
- C# List用法 List介绍
- golang-gin-优雅重启
猜你喜欢

How to quickly split and merge cell data in Excel

纸质说明书秒变3D动画,斯坦福大学吴佳俊最新研究,入选ECCV 2022

IDEA can't find the Database solution

C# using ComboBox control

232层3D闪存芯片来了:单片容量2TB,传输速度提高50%

The operator,

CLion用于STM32开发

Node version switching management using NVM

Introduction to the PartImageNet Semantic Part Segmentation dataset

【redis】发布和订阅消息
随机推荐
Open Inventor 10.12 重大改进--和谐版
ADS communicate with c #
The importance of strategic offensive capability is much higher than strategic defensive capability
Save and load numpy matrices and vectors, and use the saved vectors for similarity calculation
pytorch gpu版本安装最新
CLion用于STM32开发
技能大赛训练题:交换机虚拟化练习
战略进攻能力的重要性,要远远高于战略防守能力
Usage of += in C#
Miller_Rabin Miller Rabin probability sieve [template]
AI cocoa AI frontier introduction (7.31)
Error: npm ERR code EPERM
八大排序汇总及其稳定性
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
How to quickly split and merge cell data in Excel
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%
对数字化时代的企业来说,数据治理难做,但应该去做
纸质说明书秒变3D动画,斯坦福大学吴佳俊最新研究,入选ECCV 2022
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
SetoolKit使用指南