摘要: Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the aren 阅读全文
posted @ 2014-04-12 11:55 Shanks-香克斯 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 辗转相除法基于如下原理:两个整数的最大公约数等于其中较小的数和两数的差的最大公约数,这是一个递归过程。辗转相除法更像辗转相减法,因为辗转一次可能要减好几次,就变成了除法(取余操作)。执行过程假设要求自然数a、b的最大公约数,商依次为q0, q1, ..., qn, 余数依次为r1, r2, ..., rn,则执行过程如下:a = q0* b + r0;b = q1* r0+ r1;r0= q2* r1+ r2;r1= q3 * r2+ r3;...rn-3= qn-1* rn-2+ rn-1;rn-2= qn* rn-1+ rn;如果rn= 0; 则rn-1即为a、b的最大公约数。证明辗转相除 阅读全文
posted @ 2014-04-12 11:41 Shanks-香克斯 阅读(1347) 评论(0) 推荐(0) 编辑