当前位置:网站首页>要是我再犯这种憨憨错误就.../(ㄒoㄒ)/~~
要是我再犯这种憨憨错误就.../(ㄒoㄒ)/~~
2022-04-22 06:16:00 【S atur】
1. 乘法取模的时候,记得先取模再相乘,不要边乘边取模,不然很可能炸。
eg: HDU6961数据范围达到 1e18,而答案为 2*(n*(n-1))^2,如果写成2*n%mod*(n-1)%mod*n%mod*(n-1)%mod的话很可能在中间某个乘法运算时就会爆 long long 。
2.在涉及到浮点数的乘除运算时一定要注意精度问题。
eg:牛客2021暑期多校3的F,过程中有涉及到 8*(3-8/3)==24?时会出现精度问题,这个时候利用 x-y<=1e6这种方法会比较直观有效。
版权声明
本文为[S atur]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Satur9/article/details/119092081
边栏推荐
猜你喜欢

为什么非主键索引的叶子结点存放的数据是主键值

Redis進階

Define the class shape as the parent class, and define the method to calculate the perimeter and area in the class; (2) Define the shape subclass circle, with radius attribute and constant PI, and ove

字节暑期实习一面——20220304

Two algorithm questions for Microsoft intern interview -- 20220119

The only storage area in the JVM where GC and oom will not occur

C语言 | 数组

Jenkins deployment PM2

idea 不显示Run Dashboard视图窗口的问题

小游戏——三子棋
随机推荐
1242 · 无重叠区间
Quartus II prevents signals from being integrated
Singleton pool, singleton bean, singleton mode
Redis Advanced
[number theory] prime number (2): prime number sieve method (Egyptian sieve, Euler sieve, interval sieve)
Idea does not display the run dashboard view window
LeetCode - 6 - (字符串相乘、下一个更大元素<ⅠⅡⅢ>、k个一组翻转链表)
Quartus II防止信号被综合
[number theory] prime number (V): Mason prime number (lucas_lehmer decision method)
Cannot find interface mapping after updating HDF
字节暑期实习一面——20220304
Define an abstract role class with name, age, gender, hobbies and other member variables. It is required to hide all variables as far as possible (private if possible), and then read and write each va
Build ES6 development environment and compile in real time
手撕算法---LRU缓存淘汰策略,问的这么频繁
【数论】素数(五):梅森素数(Lucas_Lehmer判定法)
Beyond Compare“授权密钥已被吊销”的解决办法
(4) Character set in SQL Server (collation)
Binary tree chain structure operation leetcode + Niuke (detailed explanation)
Two algorithm questions for Microsoft intern interview -- 20220119
[number theory] congruence (4): univariate linear congruence equations (elimination of two, Chinese remainder theorem)