Şundan büyük pozitif tamsayılar olsun n
ve olsun .b
1
İla bir n
sonraki gücüne olan mesafeyi çıkarın b
.
İçin n=5
ve b=3
, bir sonraki güç 3
ile ilgili 5
olan 9
( 3^2 = 9
), yani çıkış 9 - 5 = 4
.
İçin n=8
ve b=2
, bir sonraki güç 2
ile ilgili 8
olan 16
( 2^4 = 16
), yani çıkış 16 - 8 = 8
. Not n
bir güçtür 2
bu örnekte.
testcases:
n b output
212 2 44
563 5 62
491 5 134
424 3 305
469 8 43
343 7 2058
592 7 1809
289 5 336
694 3 35
324 5 301
2 5 3
Bu kod golfü . Bayt cinsinden en kısa cevap kazanır. Standart boşluklar uygulanır.