HBC223556[NOIP2000]进制转换,数学,NOIP复赛MethodicMultiplication题解

凉芷 算法基础篇 58 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
After one computer crash too many, Alonso has had enough of all this shoddy software and poorly written code!

After one computer crash too many,  Alonso has had enough of all this shoddy software and poorly written code! He decides that in order for this situation to improve, the glass house that is modern programming needs to be torn down and rebuilt from scratch using only completely formal axiomatic reasoning. As one of the first steps, he decides to implement arithmetic with natural numbers using the Peano axioms. The Peano axioms (named after Italian mathematican Giuseppe Peano) are an axiomatic formalization of the arithmetic properties of the natural numbers. We have two symbols:the constant 0, and a unary successor function S. The natural numbers, starting at 0, are then0,S(0),S(S(0)),S(S(S(0)))0, S(0), S(S(0)), S(S(S(0)))0,S(0),S(S(0)),S(S(S(0))) , and so on. With these two symbols , the operations of addition and multiplication are defined inductively by the following axioms: for any natural numbers x and y, we have x+0=xx+0=xx+0=x x⋅0=0xcdot0=0x⋅0=0 x+S(y)=S(x+y)x+S(y)=S(x+y)x+S(y)=S(x+y) x⋅S(y)=x⋅y+xx · S(y) = x · y + xx⋅S(y)=x⋅y+x The two axioms on the left define addition, and the two on the right define multiplication. For instance, givenx=S(S(0))x = S(S(0))x=S(S(0)) and y=S(0)y = S(0)y=S(0)we can repeatedly apply these axioms to derive x⋅y=S(S(0))⋅S(0)=S(S(0))⋅0+S(S(0))=0+S(S(0))=S(0+S(0))=S(S(0+0))=S(S(0))x · y = S(S(0)) · S(0) = S(S(0)) · 0 + S(S(0)) = 0 + S(S(0)) = S(0 + S(0)) = S(S(0 + 0)) = S(S(0))x⋅y=S(S(0))⋅S(0)=S(S(0))⋅0+S(S(0))=0+S(S(0))=S(0+S(0))=S(S(0+0))=S(S(0)) Write a program which given two natural numbers x and y, defined in Peano arithmetic, computes the productx⋅yx · yx⋅y.

HBC223556[NOIP2000]进制转换,数学,NOIP复赛MethodicMultiplication题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC223556[NOIP2000]进制转换 数学 NOIP复赛MethodicMultiplication题解