当前位置:网站首页>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<
边栏推荐
- 尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
- C#使用NumericUpDown控件
- LeetCode·304竞赛·6132·使数组中所有元素都等于零·模拟·哈希
- C# using NumericUpDown control
- ICML2022 | Fully Granular Self-Semantic Propagation for Self-Supervised Graph Representation Learning
- 抓住金三银四的尾巴,解锁程序员面试《刷题神器》
- JSP response对象简介说明
- 1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
- STM32的CAN过滤器
- pytorch gpu版本安装最新
猜你喜欢
For enterprises in the digital age, data governance is difficult, but it should be done
图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节
golang-gin - graceful restart
Batch大小不一定是2的n次幂!ML资深学者最新结论
C# using ComboBox control
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
Solution for browser hijacking by hao360
MATLAB | 我也做了一套绘图配色可视化模板
Even if the image is missing in a large area, it can also be repaired realistically. The new model CM-GAN takes into account the global structure and texture details
Error IDEA Terminated with exit code 1
随机推荐
线程池的使用二
使用NVM进行node版本切换管理
STM32的CAN过滤器
PHP Serialization: eval
hyperf的启动源码分析(二)——请求如何到达控制器
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
技能大赛训练题:登录安全加固
ADS与C#通信
AWS implements scheduled tasks - Lambda+EventBridge
基于高阶微分器的无模型滑模控制器及其在自动电压调节器中的应用
报错IDEA Terminated with exit code 1
Unity学习笔记 关于AVPro视频跳转功能(Seeking)的说明
1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
C# control ListView usage
技能大赛训练题:域用户和组织单元的创建
csdn发文助手问题
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%
endnote引用
CodeIgniter 打开错误日志
Unity study notes Description of AVPro video jump function (Seeking)