Berbagi (karakter) Peduli!

40

Ikhtisar

Pertimbangkan tugas berikut:

Dengan bilangan bulat positif n> 0 , hasilkan akar kuadrat bilangan bulatnya. Root kuadrat integer dari bilangan n adalah nilai x terbesar di mana x 2 ≤ n , biasanya dinyatakan dengan rumus floor(sqrt(n)).

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

Tugas ini cukup mudah dengan sendirinya. Namun, dalam tantangan ini, tugas Anda adalah menyelesaikannya dalam bahasa sebanyak mungkin dengan menggunakan hanya 25 karakter.

Contoh

Pertama, Anda perlu memilih satu set (tidak ada duplikat) dari 25 byte. Ini mungkin terlihat seperti ini (perhatikan ruang utama):

 ()*-.05:=>Mabdhilmnqrst|

Tantangan Anda adalah, dengan hanya menggunakan karakter dalam set ini, membangun solusi untuk masalah dalam sebanyak mungkin bahasa berbasis teks (maaf, Piet). Anda dapat menggunakan karakter sebanyak yang diperlukan, tetapi Anda tidak boleh menggunakan karakter di luar set.

Solusi tersebut dapat berupa program atau fungsi lengkap , tetapi bukan snippet. Misalnya, menggunakan rangkaian karakter ini, saya bisa melakukan:

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

Karena saya telah menggunakan 3 bahasa, ini akan memberi saya skor 3 .

Harap sertakan juga set byte yang Anda gunakan dalam jawaban Anda.

Aturan

  • Ini adalah tantangan - skor Anda adalah jumlah bahasa yang Anda masukkan. Skor tertinggi menang. Celah standar berlaku.
  • Untuk tantangan ini, 'bahasa' dianggap sebagai bahasa pemrograman yang sangat berbeda - beberapa versi dari bahasa yang sama (Python 2, Python 3, dll) dilarang.
  • Program hanya perlu bekerja untuk input dalam rentang integer standar bahasa.
  • Program dengan kode sumber yang sama persis (polyglots) tidak diizinkan.
  • Untuk lebih spesifik, ini adalah serangkaian byte , bukan karakter - sehingga Anda dapat menggunakan 05AB1E £dan Jelly ɱsebagai karakter yang sama (karena mereka memiliki titik kode yang sama).

Tolong jangan merasa seolah-olah Anda harus mengalahkan semua solusi lain - jika Anda memiliki jawaban yang menarik, kirimkan!

FlipTack
sumber
2
Bisakah solusi kami di Piet jika kami memiliki kode menjadi ppm mentah? (mis. P3 10 10 255 ...)
Wheat Wizard
Kami membutuhkan bahasa berbasis piksel lain sehingga kami dapat memiliki polyglot dengan piet tua yang buruk
MildlyMilquetoast
2
Bisakah kita menghitung polyglot A dan B sebagai bahasa A jika kami memberikan solusi lain yang hanya berfungsi di B?
Wheat Wizard
Bisakah Anda mengklarifikasi "berbeda nyata"? Misalnya, apakah Numberwang - menggunakan digit alih-alih []<>.,+-- jelas berbeda dari Brainfuck? Bagaimana dengan SNUSP , turunan 2D Brainfuck? Untuk keduanya, kode yang dihasilkan tidak akan berfungsi di Brainfuck.
JungHwan Min
@WheatWizard Anda tidak dapat memiliki dua program yang persis sama, tetapi jika Anda memodifikasi satu untuk berbeda maka itu dibolehkan. Dan ya, jika Anda benar-benar harus, Anda dapat menggunakan ppm mentah sebagai "teks" untuk Piet: P
FlipTack

Jawaban:

37

20 bahasa

Menggunakan  ()-#*.05;=>^Vefikloqrst(24 karakter) sejauh ini:

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
Lynn
sumber
Coba tambahkan flr.(tt ^.5)untuk Keajaiban (tidak ada karakter tambahan).
Mama Fun Roll
Jika Anda ingin menambahkan, {}[] Anda dapat menambahkan Brain-Flak. Inilah programnya
Wheat Wizard
Jika Anda menambahkan ~, Anda bisa melakukannya sqrt~~di Stacked ; dibutuhkan input dari TOS dan meninggalkan output pada stack.
Conor O'Brien
julia juga memilikiisqrt
rahnema1
isqrtdi Julia tidak akan dihitung karena polyglots tidak diperbolehkan.
JungHwan Min
8

10 bahasa

Kumpulan karakter 19 karakter (dalam CP-1252 ):

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

Di mana mewakili umpan baris dan mewakili carriage return .

( Skrip untuk memeriksa karakter )


Jelly, 2 byte

ƽ

Cobalah online!

05AB1E, 2 byte

t1X-^

Cobalah online!

GS2, 2 byte

V-

Cobalah online!

Jolf, 3 byte

mfU

Coba di sini! (berfungsi terbaik di Firefox)

Japt, 2 byte

¬f

Coba di sini!

MATL, 3 byte

X^k

Cobalah online!

Pyke, 3 byte

,1f

Coba di sini!

Pyth, 6 byte

/@Q2t2

Coba di sini!

Oasis, 6 byte

1␊2/m1÷

Cobalah online!

2sable, 9 byte

t1X-XX--^

Cobalah online!

Adnan
sumber
cUjuga bekerja di Jolf.
Conor O'Brien
@ ConorO'Brien Meskipun lebih pendek, itu berarti menambahkan cke daftar karakter. Dia sudah menggunakan keduanya m(di sub-jawaban Oasis) dan f(di sub-jawaban Japt dan Pyke).
Kevin Cruijssen
@KevinCruijssen ik, ini hanya untuk anak cucu
Conor O'Brien
6

5 bahasa

Akan menambahkan lebih banyak bahasa segera.

Kumpulan karakter (22 byte):

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

Pyth

s^Q.5

Javascript

Q=>Q**.5|0

Sebenarnya

√L

CJam

rdmQ

Python

lambda Q:Q**.5//1
Maltysen
sumber
2
Anda dapat mengganti |dengan ^dalam jawaban JavaScript Anda untuk menyimpan byte di set karakter Anda.
Lynn
6

5 bahasa

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

18 karakter.

Saya mencoba untuk tidak menggunakan karakter alfabet ...

Brainfuck , Brainfuck ++ , Brainfuck-ng , Braintrust , ...

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

Tidak berfungsi selama lebih 224karena 256(= (sqrt (225) +1) ^ 2) meluap.

Ganti semua -dengan +s untuk menggunakan satu karakter lebih sedikit. (misalnya --> 255 +s)

Program Asli

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

Brain-Flak

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

@ Kode WheatWizard Terima kasih atas izinnya!

Brain-Flueue

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

Kode @ WheatWizard lain.

Numberwang

8440999999419999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999999917049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991907111499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999900911778700000009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994111114999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999090911704999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999190711949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991190000911700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999911900711114004190009119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997140919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970000000091111400091149999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990904999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999711700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909171499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919071999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999990499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994191171494999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999091719117000007111419999994999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999099999999170349999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997799999949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999991703

Sendok

00101100010000100010111111001000110000000000000000000000000100000011010001000000101111111111011001101000100000011101000110110110110010000001001010110110011001100101100011010010010010010010010000001000110110110110110010000001010101011011001101000100000011101000110110111001000000110111010010010010101101100110100100010000001101110100100011011011011011001000100100010001110100100101011011000001101100100010101100000110110000011010010010010010010010010101101101101100100010010010101101100100000010101000100000001101101100110100100010000001010110011011001000000111010001101100001100000110100010000000110100100100000011011011011011011011000011111111111101000100000011000001000111011011001101100100100100000010101100110111011011001101001001001001000110110110110010001111111100100000010111111110110011010001010001000000011001111111100100000010111111110110011010001010

Per konsensus meta, kode ini harus baik-baik saja, meskipun saat ini tidak ada juru bahasa.

JungHwan Min
sumber
4

5 bahasa

Menggunakan ()*/12 dlinpqrstudan baris baru (18 karakter) sejauh ini.

Gangguan umum

isqrt

Fungsi bawaan.

QBasic

input q
print int(sqr(q))

Python 3

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

Python 3 digunakan untuk divisi floating-point tanpa titik desimal.

Pip

q**/2//1

Golf yang tidak perlu untuk memamerkan operator inversi unary /. Mengambil input dari stdin. Cobalah online!

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)))

sqrtadalah fungsi pembantu yang argumennya adalah: tebakan saat ini n, nkuadrat, dan inputangka. Jika inputkurang dari nsqr, kami sudah melangkah terlalu jauh, jadi kembalikan nminus 1; jika tidak, kambuh, tambahkan 1 ke ndan tambahkan n + n + 1ke nsqr. (Matematika agak rumit karena tinylisp hanya memiliki pengurangan bawaan.) Baris kedua mendefinisikan fungsi aktual kita, yang mengambil satu inputdan mengembalikan hasil sqrtdengan nmulai dari 1.

DLosc
sumber
Jika Anda ingin menambahkan, {}[] Anda dapat menambahkan Brain-Flak. Inilah programnya
Wheat Wizard
3

6 bahasa

Sejauh ini, menggunakan retun flosq(agm1)\,idan memperpanjang codepoint B1dan BCuntuk 22 byte.

Bahasa GameMaker

return floor(sqrt(argument1))

Pyke

,1f

Julia

isqrt

Maple

(isqrt)

Terjebak

i\

TI-Basic (hex dump)

B1 BC 72

Perhatikan bahwa 0x72 rdalam ASCII.

Timtech
sumber
1

7 bahasa

24 karakter:

limQi->(nt)Mah.sqr_ ?;:\

CJam

limQ
li       e#Read Int
  mQ     e#Integer square root

Jawa

i->(int)Math.sqrt(i)

Kode rantai

q_
q  #sQuare root
 _ #floor

Matematika ++

_sqrt ?

Menyeringai

;q:

Terjebak

i\)

Tidak lurus

iMivMiMs
i            Read input
 Mi          Convert to int
    v        Square root
    Mi       Convert to int
      Ms     Convert to String

R

sqrt

Biaya byte terlalu banyak

Python

lambda i:int(i**.5)
Roman Gräf
sumber
Dapat menambahkan R:sqrt
JAD