题目 For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, diference, product and quotient. Input Specification: Each input file contains one test case, which gives in one line the two rational numb…
题目 Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum. Input Specification: Each input file contains one test case. Each case starts with a positive integer N (<=100), followed in the next li…
题目 Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers A and B. For example, afer cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can be devided by the product of…
题目 Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given any positive N, you are supposed to find the ma…
1.注意在数字和string转化过程中,需要考虑数字不是只有一位的,如300转为"300",一开始卡在里这里, 测试用例: 24/8 100/10 24/11 300/11 2.该题用到了欧几里德算法求最小公约数gcd(a,b) 算法如下: //欧几里德算法求最大公约数gcd,其中a>b long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a%b); } AC代码如下: //#include&l…
1088. Rational Arithmetic (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient. Input Spe…