惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Latest news
Latest news
H
Help Net Security
C
CERT Recently Published Vulnerability Notes
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Security Latest
Security Latest
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
T
Threatpost
量子位
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
博客园 - 聂微东
博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
小众软件
小众软件
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
L
LangChain Blog
SecWiki News
SecWiki News
H
Hacker News: Front Page
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
H
Heimdal Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 【当耐特】
A
About on SuperTechFans
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog

博客园 - 零零猪

基于Windows Server 2008 R2的Failover Cluster(故障转移群集)部署Sql Server 2008 AA(主主) 模式群集(第二部分) 基于Windows Server 2008 R2的Failover Cluster(故障转移群集)部署Sql Server 2008 AA(主主) 模式群集(第一部分) Office 2010众多客户端产品、服务器产品试用下载 免费发短信,短信云计算?? Asp.Net MVC 1.0 Action Filters Tips 暂时做一个快乐的SOHO族 Asp.Net MVC使用HtmlHelper渲染,并传递FormCollection参数的陷阱 ASP.Net MVC Relational KeyWord 4 Google 【More...】【欢迎补充】 本博客加入“署名-非商业性使用-禁止演绎 2.5 中国大陆”许可协议 Exchange 2007 队列数据库、队列事务日志文件超过临界值(阈值)导致无法接受邮件解决方案 10步完成Windows 2003+SQLServer 2005 群集(Cluster)安装及配置【备案】 C# 3.0通过Linq、Lambda、匿名函数、代理函数实现数据查询 photosynth Trial MOSS 2007 爬网规则 Contentclass常用属性设置 有用的SharePoint英文资源[持续更新] MOSS2007中Feature对象模型操作 SQL日志收缩(ZZ) Microsoft photosynth(图片三维展示) MOSS2007匿名调查列表使用分页符导致的错误分析
整型运算三个恒等式
零零猪 · 2009-11-27 · via 博客园 - 零零猪

整型运算满足如下三个恒等式(不考虑溢出的情况下):
i + j - j === i;
i * j / j === i;
i / j * j + i % j === i
我们可以看出来在这几个式子中,我们可以得出这样的结论。

1、如果我们知道i+j和j,则i的值即可确定。
2、如果我们知道i-j和j,则i的值即可确定。
3、如果我们知道i*j和j,则i的值即可确定。
但我们仅知道i/j和j,不可能确定i的值
而是
4、如果我们知道i/j和i%j还有j的值,则i可以确定。
所以在计算平均值这样的场景,我们仅仅保存i/j和j的值,是不够的。如果加上i%j,则i的值也是可逆的。
所以在除法运算时,为了能够还原计算前的值,我们必须保存余数。

Summarized by Ivony

================================================================
转载要求及授权协议:
作者
零零猪(or)Jiessie327(or)JiessieLiang 
出处http://jiessie327.cnblogs.com/
版权:本文版权归作者所有
转载:欢迎转载,为了尊重作者的劳动成果,在【转载】时请按作者要求,指明文章【出处】或给出【原文链接】,谢谢
================================================================

请遵守署名-非商业性使用-禁止演绎 2.5 中国大陆 License.
================================================================