当前位置:网站首页>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< 边栏推荐
- golang-gin-pprof-使用以及安全问题
- 页面整屏滚动效果
- C语言基础练(九九乘法表)与打印不同星号图案
- Miller_Rabin Miller Rabin probability sieve [template]
- Selenium IDE for Selenium Automation Testing
- C#高级--委托
- golang-gin - graceful restart
- MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
- 图像大面积缺失,也能逼真修复,新模型CM-GAN兼顾全局结构和纹理细节
- The pre-sale of the new Hyundai Paristi is open, and safety and comfort are not lost
猜你喜欢
随机推荐
技能大赛dhcp服务训练题
深度剖析 Apache EventMesh 云原生分布式事件驱动架构
Error IDEA Terminated with exit code 1
C#控件 ToolStripProgressBar 用法
已解决(pymysqL连接数据库报错)pymysqL.err.ProgrammingError: (1146,“Table ‘test.students‘ doesn‘t exist“)
基于改进YOLOv5的轻量化航空目标检测方法
Shell脚本经典案例:文件的备份
代码随想录笔记_哈希_454四数相加II
C#使用NumericUpDown控件
CLion用于STM32开发
golang-gin - graceful restart
Save and load numpy matrices and vectors, and use the saved vectors for similarity calculation
[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
leetcode: 485. Maximum number of consecutive 1s
「面经分享」西北大学 | 字节 生活服务 | 一面二面三面 HR 面
Shell项目实战1.系统性能分析
Use of C# Assembly
网络协议及相关技术详解
C# List用法 List介绍
The pre-sale of the new Hyundai Paristi is open, and safety and comfort are not lost








