- 博客(2)
- 收藏
- 关注
原创 C++ 最大公约数求法(辗转相除法)
简介:辗转相除法又叫做欧几里得算法,是指用于计算两个正整数a,b的最大公约数。思想:用较大的数除以较小的数得到余数,再用较小的数除以余数以此循环,直到最后余数为零,最后除的数即为最大公约数,代码为表示为gcd(a,b)=gcd(b,a mod b);例:假如需要求 1997 和 615 两个正整数的最大公约数,用欧几里德算法,是这样进行的:1997 / 615 = 3 (余 152)...
2020-03-12 03:15:44 4075
原创 03-树2 List Leaves (25 分)
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file contains one test case. For each case, the first line gives a po...
2019-07-29 15:16:35 133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人