modulo power (지수가 지수형태일 때) https://codefights.com/forum/kk5YnGxknN9MtD2kF a, n 이 a, n 카테고리 없음 2016.09.03
GCD while (t > 0) t = s % (s = t);위 while 루프를 수행후에s 값에는 while 루프를 수행하기 직전의 s, t의 GCD가 저장된다. 카테고리 없음 2015.03.18
powerOfTwo 106 Chrs int i,s=1; int[] powerOfTwo(int N) { int[] a = new int[Long.bitCount(N)]; for (;s>0;s*=2) if (0 < (N & s)) a[i++]=s; return a; } 112 Chrs int[] powerOfTwo(int N) { int i=0,s=1,c=Long.bitCount(N); int[] a = new int[c]; for (;i0;) N-=a[i++] = Integer.lowestOneBit(N); return a; } 카테고리 없음 2015.03.17
fibonacciSum int s,x,y,k; int[] fibonacciSum(int N) { int[] z,r; z = new int[N]; for (;N > 0;N-=z[s++]=x) for (x=y=1; N >= y; y += x, x = y - x); r = new int[s]; for (;k 카테고리 없음 2015.03.17