当前位置:网站首页>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< 边栏推荐
- 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
- C# using ComboBox control
- 为什么 wireguard-go 高尚而 boringtun 孬种
- Sliding window method to segment data
- 拥塞控制,CDN,端到端
- Error IDEA Terminated with exit code 1
- 技能大赛训练题:MS15_034漏洞验证与安全加固
- Batch大小不一定是2的n次幂!ML资深学者最新结论
- Reasons and solutions for Invalid bound statement (not found)
- 滑窗法切分数据
猜你喜欢

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

抓住金三银四的尾巴,解锁程序员面试《刷题神器》

3.爬虫之Scrapy框架1安装与使用

CLion用于STM32开发

LeetCode·304竞赛·6132·使数组中所有元素都等于零·模拟·哈希

hyperf的启动源码分析(二)——请求如何到达控制器

C# control ListView usage

1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点

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

Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
随机推荐
基于模糊预测与扩展卡尔曼滤波的野值剔除方法
1-hour live broadcast recruitment order: industry leaders share dry goods, and enterprise registration is open丨qubit · point of view
Unity学习笔记 关于AVPro视频跳转功能(Seeking)的说明
CLion用于STM32开发
C#使用ComboBox控件
C# using NumericUpDown control
C#高级--委托
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
Miller_Rabin Miller Rabin probability sieve [template]
Reasons and solutions for Invalid bound statement (not found)
C#获得网卡信息 NetworkInterface IPInterfaceProperties
MATLAB | 我也做了一套绘图配色可视化模板
How to quickly split and merge cell data in Excel
DELL SC compellent 康贝存储系统怎么抓取配置信息
C#中+=的用法
一篇文章讲清楚!数据库和数据仓库到底有什么区别和联系?
PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
机器学习模型验证:被低估的重要一环
Shell项目实战1.系统性能分析
1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点