Files
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

22 lines
500 B
Ruby

=begin
File: fast_power.rb
Created Time: 2026-08-18
Author: Hello Algo Team
=end
### 빠른 거듭제곱 ###
def fast_pow(x, n)
return 1 if n == 0
half = fast_pow(x, n / 2)
return half * half if n.even?
half * half * x
end
if __FILE__ == $0
raise '빠른 거듭제곱 검증에 실패했다' unless fast_pow(7, 0) == 1
raise '빠른 거듭제곱 검증에 실패했다' unless fast_pow(3, 5) == 243
raise '빠른 거듭제곱 검증에 실패했다' unless fast_pow(2, 6) == 64
end