Paylaşma (karakterler) İlgileniyor!


40

genel bakış

Aşağıdaki görevi göz önünde bulundurun:

Olumlu bir tamsayı n> 0 verildiğinde , tamsayı kare kökünü çıkar. Bir sayısının tam kare kökü , n en büyük değerdir x x 2 ≤ n genellikle formül ile ifade edilen floor(sqrt(n)).

Örnekler: 25 -> 5, 24 -> 4, 40 -> 6, 1 -> 1.

Bu görev kendi başına yeterince kolaydır. Ancak, bu zorlukta, göreviniz bunu sadece 25 karakterlik bir dizi kullanarak mümkün olduğu kadar çok dilde çözmek .

Örnek

Öncelikle, 25 baytlık bir küme (kopya yok) seçmeniz gerekir . Böyle bir şeye benzeyebilir (baştaki boşluğa dikkat edin):

 ()*-.05:=>Mabdhilmnqrst|

Buradaki zorluk, bu setteki sadece karakterleri kullanarak mümkün olduğunca çok sayıda metin tabanlı (üzgünüm, Piet) dilde soruna bir çözüm oluşturmaktır . Karakterleri gerektiği kadar kullanabilirsiniz, ancak kümenin dışındaki karakterleri kullanmamalısınız.

Çözümler tam programlar veya işlevler olabilir , ancak snippet'ler olmayabilir. Örneğin, bu karakter kümesini kullanarak şunları yapabilirdim:

M -> (int) Math.sqrt(M)    // Java (lambda expression)
M => Math.sqrt(M)|0        // Javascript (unnamed function)
lambda M: int(M**.5)       // Python (lambda function)

3 dili kullandığım için bu bana 3 puan verecek .

Lütfen ayrıca cevabınıza kullandığınız bayt kümesini de ekleyin.

kurallar

  • Bu bir mücadelesidir - puanınız, gönderdiğiniz dillerin sayısıdır. En yüksek puan kazanır. Standart boşluklar uygulanır.
  • Bu zorluk için, bir 'dil' farklı bir programlama dili olarak sayılır - aynı dilin çoklu sürümleri (Python 2, Python 3, vb.) Yasaklanmıştır.
  • Programların yalnızca dilin standart tamsayı aralığındaki girişler için çalışması gerekir.
  • Tam olarak aynı kaynak kodlu programlara (polyglots) izin verilmez.
  • Daha açık olmak gerekirse, karakterlerden değil bir bayt kümesidir - 05AB1E £ve Jelly'i ɱaynı karakter olarak kullanabilirsiniz (çünkü aynı kod noktasına sahiptirler).

Lütfen diğer tüm çözümleri yenmek zorunda olduğunuzu düşünmeyin - ilginç bir cevabınız varsa gönderin!


2
Ham ppm kodumuz varsa çözümümüz Piet'de olabilir mi? (örneğin P3 10 10 255 ...)
Buğday Sihirbazı

Başka bir piksel tabanlı dile ihtiyacımız var, zavallı yaşlı
pete ile çokgenlere

2
Yalnızca B'de çalışan başka bir çözüm sunarsak, A ve B dilini A dili olarak sayabilir miyiz?
Buğday Sihirbazı

"Kesinlikle farklı" ifadesini açıklayabilir misiniz? Örneğin, Numberwang[]<>.,+- - yerine rakamlar - Brainfuck'tan belirgin şekilde farklı mı? 2D Brainfuck türevi olan SNUSP'den ne haber ? Her ikisi için de ortaya çıkan kod Brainfuck'ta çalışmaz.
JungHwan Min

@WheatWizard, tamamen aynı olan iki programa sahip olamazsınız, ancak birini farklı olacak şekilde değiştirirseniz izin verilir. Ve evet, gerçekten yapmak gerekirse, Piet: P
FlipTack

Yanıtlar:


37

20 dil

 ()-#*.05;=>^VefikloqrstŞimdiye kadar (24 karakter) kullanarak :

let f l=floor(l**0.5);;       OCaml
let f l=floor(l**0.5)         F#
f(l)=floor(l^.5)              Julia
f(o)=floor(o^.5)              PARI/GP
s^+>5 0>5 0*.5l               Pyth
(* **.5).floor                Perl 6
floor.(**0.5)                 Haskell
flr.(tt ^.5)                  Wonder
l=>l**.5^0                    JavaScript
l->l**.5^0                    Cheddar
.5^5*5f                       Pyke
(isqrt)                       Maple
ri.5#i                        CJam
isqrt                         Common Lisp
0.5^k                         MATL
*.5^0                         Jelly
*.^0                          M
t0^                           05AB1E
q f                           Japt
r#                            Pushy
V-                            gs2

flr.(tt ^.5)Wonder için eklemeyi deneyin (eklenmiş karakter yok).
Mama Fun Roll

Eklemek {}[] isterseniz Brain-Flak ekleyebilirsiniz. İşte program
Buğday Sihirbazı

Eğer eklediyseniz ~, Yapabileceğin sqrt~~içinde Yığın ; TOS'tan girdi alır ve istif üzerindeki çıktıyı bırakır.
Conor O'Brien,

julia da vardırisqrt
rahnema1 10:17

isqrtJulia'da sayılmaz çünkü çokgenlere izin verilmiyor.
JungHwan Min

8

10 dil

19 karakterlik karakter kümesi ( CP-1252'de ):

,-/12@QUVX^fkmt¬÷␊␍

Burada bir temsil hat besleme ve bir temsil satır başı .

( Karakterleri kontrol etmek için komut dosyası )


Jöle, 2 bayt

ƽ

Çevrimiçi deneyin!

05AB1E, 2 bayt

t1X-^

Çevrimiçi deneyin!

GS2, 2 bayt

V-

Çevrimiçi deneyin!

Jolf, 3 bayt

mfU

Burada dene! (en iyi Firefox'ta çalışır)

Japt, 2 bayt

¬f

Burada dene!

MATL, 3 bayt

X^k

Çevrimiçi deneyin!

Pyke, 3 bayt

,1f

Burada dene!

Pyth, 6 bayt

/@Q2t2

Burada dene!

Vaha, 6 bayt

1␊2/m1÷

Çevrimiçi deneyin!

2sable, 9 bayt

t1X-XX--^

Çevrimiçi deneyin!


cUayrıca Jolf'ta da çalışıyor.
Conor O'Brien,

@ ConorO'Brien Kısa olmasına rağmen c, karakter listesine eklemek anlamına gelir . Zaten her ikisini de m(Oasis alt cevabında) ve f(Japt ve Pyke alt cevabında) kullanıyor.
Kevin Cruijssen

@KevinCruijssen ik, sadece gelecek için
Conor O'Brien

6

5 dil

Yakında daha fazla dil ekleyeceğim.

Karakter seti (22 bayt):

s^Q.5=>*|0√Lrdmlab :/1

Pyth

s^Q.5

JavaScript

Q=>Q**.5|0

Aslında

√L

CJam

rdmQ

piton

lambda Q:Q**.5//1

2
Sen yerini alabilir |tarafından ^karakter kümesindeki bir byte kaydetmek için JavaScript yanıtında.
Lynn

6

5 dil

[].,+<>{}()0134879

18 karakter

Herhangi bir alfabe karakteri kullanmamaya çalışıyorum ...

Brainfuck , Brainfuck ++ , Brainfuck-ng , Braintrust , ... hakkında

,[[>++++++[<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++<]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+<<]],]>>>>>>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[<<<<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+>+<<]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<<+[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<+>>>>+<<]>>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<+>>]<<<<[>>[<+>>>+<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<[>+<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>>>>>>>>+<<<<[>>>+<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<<]>>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+<]<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<++++++++++>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[<+<<]<[+[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+<]<+<<]>>>>>]<<<[<++++++[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++<]>.[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]]++++++[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++<]>.

Üzerinde çalışmıyor 224 çünkü 256(= (sqrt (225) +1) ^ 2) taşmıştır.

Bir s daha az karakter kullanmak için -s'yi s ile değiştirin +. (Örneğin- -> 255 +s)

Orijinal Program

,[[>++++++[<-------->-]>[->++++++++++<]>[-<+>]<<<[->>+<<]],]>>>>>>>-[<<<<<[->+>+<<]>[-<+>]<<+[-<<+>>>>+<<]>>[-<<+>>]<<<<[>>[<+>>>+<<-]<[>+<-]<-]>>>>>>>>+<<<<[>>>+<<[->+>[-]<<]>>[->+<]<[-<+>]<-<-]>[-]>>>-]<<<<<<-<++++++++++>[-<-[<+<<]<[+[->+<]<+<<]>>>>>]<<<[<++++++[->++++++++<]>.[-]]++++++[->++++++++<]>.

Beyin Flak

({}(())[()])(()){{}((({})({}((({}())))[{}{({})({}[()])}{}]))[({}[{}])])([({}(())[()])]){(({}()({}[(({}[(())]()){(([({}{})]{}))}{})]{}))[({}[{}])])}{}{}}{}{}({}[()])

@ WheatWizard'ın kodu. İzin için teşekkürler!

Beyin Flueue

({}())(())(())({}){{}({})({}<(({})<({({})({}[()])}{})>())>)([{}]<({})>({}))({}<‌​({}<([({})]){()<({}())>}{}(<()>){({}[()])([{}]())}{}>)>)({}<({})>)({})({})}{}({}[‌​()()]){}

Bir başka @ WheatWizard'ın kodu.

Numberwang

8440999999419999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999999917049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991907111499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999900911778700000009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994111114999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999090911704999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999190711949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991190000911700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999911900711114004190009119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997140919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970000000091111400091149999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990904999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999711700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909171499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919071999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999990499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994191171494999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999091719117000007111419999994999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999099999999170349999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997799999949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999991703

Kaşık

00101100010000100010111111001000110000000000000000000000000100000011010001000000101111111111011001101000100000011101000110110110110010000001001010110110011001100101100011010010010010010010010000001000110110110110110010000001010101011011001101000100000011101000110110111001000000110111010010010010101101100110100100010000001101110100100011011011011011001000100100010001110100100101011011000001101100100010101100000110110000011010010010010010010010010101101101101100100010010010101101100100000010101000100000001101101100110100100010000001010110011011001000000111010001101100001100000110100010000000110100100100000011011011011011011011000011111111111101000100000011000001000111011011001101100100100100000010101100110111011011001101001001001001000110110110110010001111111100100000010111111110110011010001010001000000011001111111100100000010111111110110011010001010

Herhangi bir tercüman bulunmamasına rağmen , meta konsensüs başına bu kod tamam olmalıdır.


4

5 dil

kullanma ()*/12 dlinpqrstu ve şimdiye kadar satır (18 karakter).

Ortak Lisp

isqrt

Yerleşik bir işlev.

QBasic

input q
print int(sqr(q))

Python 3

print(int(int(input())**(1/2)))

Python 3 ondalık basamaksız kayan noktalı bölme için kullanılır.

bip

q**/2//1

Gereksiz yere unary inversion operatörü göstermek için golf /. Stdin'den girdi alır. Çevrimiçi deneyin!

tinylisp

(d sqrt (q((n nsqr input) (i (l input nsqr) (s n 1) (sqrt (s n (s 1 2)) (s 2 (s (s (s 1 n) n) nsqr)) input)))))
(q((input)(sqrt 1 1 input)))

sqrtargümanları olan bir yardımcı fonksiyon: güncel tahmin n, nkare ve inputsayı. Eğer inputdaha küçükse nsqr, çok ileri gittik, bu yüzden neksi 1'e dönün ; Aksi, recurse, 1 ekleyerek nve ekleme n + n + 1için nsqr. (Matematik tinylisp sadece çıkarma yerleşik olduğu için biraz karmaşık.) İkinci çizgi bir tek alır eden gerçek işlevi tanımlar inputve sonucunu verir sqrtile n1 den başlayarak.


Eklemek {}[] isterseniz Brain-Flak ekleyebilirsiniz. İşte program
Buğday Sihirbazı,

3

6 dil

retun flosq(agm1)\,iKod noktaları B1ve BCbugüne kadar 22 bayt kullanarak ve genişletilmiş .

GameMaker Dili

return floor(sqrt(argument1))

Pyke

,1f

Julia

isqrt

Akçaağaç

(isqrt)

sıkışmış

i\

TI-Basic (altıgen dökümü)

B1 BC 72

0x72'nin rASCII'de olduğuna dikkat edin .


Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.