常見的算法實現

1. 求最大公約數           展轉相除法 java private static int gcd(int x,int y){ if(x<y) return gcd(y,x); if(y==0) return x; else return gcd(x-y,y); } 2. 十進制轉換成任意進制     思路:數組          一、十進制數 num 轉換爲 n
相關文章
相關標籤/搜索