Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0. Example:Given a / b =…
7.4 Write methods to implement the multiply, subtract, and divide operations for integers. Use only the add operator. 这道题让我们实现乘法加法和除法,而且规定了只能使用加法.那么我们先来看如何用加法来实现减法,我们知道,减去一个数就等于加上这个数的负数.那么我们先写一个求负数的函数,对于n来说,我们累计n个-1,对于-n来说,我们累计n个1.这样减法的就搞定了,我们再来看乘法,乘…
题目描述 Given two postive integers A and B, please calculate the maximum integer C that C*B≤A, and the real number D equal to A/B. 输入格式 Two integers A and B in one line separated by a space.(A,B>0) 输出格式 Output C in one line,followed by D in one line. D…