Chia sẻ (nhân vật) là quan tâm!


40

Tổng quan

Hãy xem xét các nhiệm vụ sau:

Cho một số nguyên dương n> 0 , xuất căn bậc hai số nguyên của nó. Căn bậc hai nguyên của một số n là giá trị lớn nhất của x trong đó x 2 n , thường được biểu thị bằng công thức floor(sqrt(n)).

Ví dụ: 25 -> 5, 24 -> 4, 40 -> 6, 1 -> 1.

Nhiệm vụ này là đủ dễ dàng trên chính nó. Tuy nhiên, trong thử thách này, nhiệm vụ của bạn là giải quyết vấn đề này bằng càng nhiều ngôn ngữ càng tốt bằng cách sử dụng một bộ chỉ gồm 25 ký tự.

Thí dụ

Trước tiên, bạn cần chọn một bộ (không trùng lặp) 25 byte. Nó có thể trông giống như thế này (lưu ý không gian hàng đầu):

 ()*-.05:=>Mabdhilmnqrst|

Thử thách của bạn là sau đó, chỉ sử dụng các ký tự trong bộ này, xây dựng một giải pháp cho vấn đề bằng càng nhiều ngôn ngữ dựa trên văn bản (xin lỗi, Piet) càng tốt. Bạn có thể sử dụng các ký tự nhiều lần nếu cần, nhưng bạn không được sử dụng các ký tự bên ngoài bộ.

Các giải pháp có thể là chương trình hoặc chức năng đầy đủ , nhưng không phải là đoạn trích. Ví dụ: sử dụng bộ ký tự này, tôi có thể làm:

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

Vì tôi đã sử dụng 3 ngôn ngữ, điều này sẽ cho tôi điểm 3 .

Vui lòng bao gồm tập hợp các byte bạn đang sử dụng trong câu trả lời của bạn.

Quy tắc

  • Đây là một thử thách - điểm của bạn là số ngôn ngữ mà bài nộp của bạn bao gồm. Điểm cao nhất sẽ thắng. Tiêu chuẩn áp dụng.
  • Đối với thử thách này, một 'ngôn ngữ' được tính là ngôn ngữ lập trình khác biệt - nhiều phiên bản của cùng một ngôn ngữ (Python 2, Python 3, v.v.) đều bị cấm.
  • Các chương trình chỉ cần hoạt động cho các đầu vào trong phạm vi số nguyên tiêu chuẩn của ngôn ngữ.
  • Các chương trình có cùng mã nguồn (polyglots) không được phép.
  • Cụ thể hơn, đó là một tập hợp các byte , không phải các ký tự - vì vậy bạn có thể sử dụng 05AB1E £và Jelly ɱlàm cùng một ký tự (vì chúng có cùng một mật mã).

Xin đừng cảm thấy như thể bạn phải đánh bại tất cả các giải pháp khác - nếu bạn có câu trả lời thú vị, hãy đăng nó!


2
Giải pháp của chúng tôi có thể ở Piet nếu chúng tôi có mã là ppm thô không? (ví dụ P3 10 10 255 ...)
Thuật sĩ lúa mì

Chúng tôi cần một ngôn ngữ dựa trên pixel khác để chúng tôi có thể có các đa âm với piet cũ kém
MildlyMilquetoast

2
Chúng ta có thể tính một đa âm của A và B là ngôn ngữ A nếu chúng ta cung cấp một giải pháp khác chỉ hoạt động trong B không?
Thuật sĩ lúa mì

Bạn có thể làm rõ "khác biệt rõ ràng"? Ví dụ, được Numberwang --using chữ số thay vì []<>.,+-- khác biệt rõ rệt từ Brainfuck? Còn SNUSP , một dẫn xuất 2D Brainfuck thì sao? Đối với cả hai, mã kết quả sẽ không hoạt động trong Brainfuck.
JungHwan Min

@WheatWizard bạn không thể có hai chương trình hoàn toàn giống nhau, nhưng nếu bạn sửa đổi một chương trình thành khác nhau thì điều đó được cho phép. Và vâng, nếu bạn thực sự cần, bạn có thể sử dụng ppm thô làm "văn bản" cho Piet: P
FlipTack

Câu trả lời:


37

20 ngôn ngữ

Sử dụng  ()-#*.05;=>^Vefikloqrst(24 ký tự) cho đến nay:

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

Hãy thử thêm flr.(tt ^.5)cho Wonder (không thêm ký tự).
Mama Fun Roll

Nếu bạn muốn thêm {}[] bạn có thể thêm Brain-Flak. Đây là chương trình
Wheat Wizard

Nếu bạn đã thêm ~, bạn có thể làm sqrt~~trong Stacked ; nó lấy đầu vào từ ĐKDV và để lại đầu ra trên ngăn xếp.
Conor O'Brien

julia cũng cóisqrt
rahnema1

isqrttrong Julia sẽ không được tính vì polyglots không được phép.
JungHwan Min

8

10 ngôn ngữ

Bộ ký tự gồm 19 ký tự (trong CP-1252 ):

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

Trong đó đại diện cho một nguồn cấp dữ liệuđại diện cho một sự trở lại vận chuyển .

( Kịch bản để kiểm tra các ký tự )


Thạch, 2 byte

ƽ

Hãy thử trực tuyến!

05AB1E, 2 byte

t1X-^

Hãy thử trực tuyến!

GS2, 2 byte

V-

Hãy thử trực tuyến!

Jolf, 3 byte

mfU

Hãy thử nó ở đây! (hoạt động tốt nhất trên Firefox)

Japt, 2 byte

¬f

Hãy thử nó ở đây!

MATL, 3 byte

X^k

Hãy thử trực tuyến!

Pyke, 3 byte

,1f

Hãy thử nó ở đây!

Bình thường, 6 byte

/@Q2t2

Hãy thử nó ở đây!

Ốc đảo, 6 byte

1␊2/m1÷

Hãy thử trực tuyến!

2sable, 9 byte

t1X-XX--^

Hãy thử trực tuyến!


cUcũng hoạt động trong Jolf.
Conor O'Brien

@ ConorO'Brien Mặc dù ngắn hơn nhưng có nghĩa là thêm cvào danh sách các ký tự. Anh ấy đã sử dụng cả hai m(trong câu trả lời phụ Oasis) và f(trong câu trả lời phụ của Japt và Pyke).
Kevin Cruijssen

@KevinCruijssen ik, nó chỉ dành cho hậu thế
Conor O'Brien

6

5 ngôn ngữ

Gonna thêm nhiều ngôn ngữ sớm.

Bộ ký tự (22 byte):

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

Bình

s^Q.5

Javascript

Q=>Q**.5|0

Thực ra

√L

Camam

rdmQ

Con trăn

lambda Q:Q**.5//1

2
Bạn có thể thay thế |bằng ^câu trả lời JavaScript của mình để lưu một byte trong bộ ký tự của bạn.
Lynn

6

5 ngôn ngữ

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

18 ký tự.

Tôi đang cố gắng không sử dụng bất kỳ ký tự bảng chữ cái nào ...

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

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

Không làm việc trong hơn 224256(= (sqrt (225) +1) ^ 2) tràn.

Thay thế tất cả -s bằng +s để sử dụng một ký tự ít hơn. (ví dụ: -> 255 +giây)

Chương trình gốc

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

Brain-Flak

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

@ Mã của WheatWizard. Cảm ơn sự cho phép!

Brain-Flueue

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

Mã khác của @ WheatWizard.

Số

8440999999419999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999999917049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991907111499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999900911778700000009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994111114999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999090911704999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999190711949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991190000911700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999911900711114004190009119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997140919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970000000091111400091149999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990904999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999711700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909171499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919071999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999990499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994191171494999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999091719117000007111419999994999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999099999999170349999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997799999949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999991703

Cái thìa

00101100010000100010111111001000110000000000000000000000000100000011010001000000101111111111011001101000100000011101000110110110110010000001001010110110011001100101100011010010010010010010010000001000110110110110110010000001010101011011001101000100000011101000110110111001000000110111010010010010101101100110100100010000001101110100100011011011011011001000100100010001110100100101011011000001101100100010101100000110110000011010010010010010010010010101101101101100100010010010101101100100000010101000100000001101101100110100100010000001010110011011001000000111010001101100001100000110100010000000110100100100000011011011011011011011000011111111111101000100000011000001000111011011001101100100100100000010101100110111011011001101001001001001000110110110110010001111111100100000010111111110110011010001010001000000011001111111100100000010111111110110011010001010

Theo sự đồng thuận của meta, mã này sẽ ổn, mặc dù hiện tại không có thông dịch viên.


4

5 ngôn ngữ

Sử dụng ()*/12 dlinpqrstuvà dòng mới (18 ký tự) cho đến nay.

Lisp thường gặp

isqrt

Một chức năng tích hợp.

QBasic

input q
print int(sqr(q))

Con trăn 3

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

Python 3 được sử dụng để phân chia dấu phẩy động không có dấu thập phân.

Đường ống

q**/2//1

Chơi golf không cần thiết để thể hiện các toán tử đảo ngược unary /. Lấy đầu vào từ stdin. Hãy thử trực tuyến!

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

sqrtlà một hàm trợ giúp có các đối số là: đoán hiện tại n, nbình phương và inputsố. Nếu inputít hơn nsqr, chúng ta đã đi quá xa, vì vậy hãy trả lại nâm 1; mặt khác, lặp lại, thêm 1 vào nvà thêm n + n + 1vào nsqr. (Toán học là một chút phức tạp vì tinylisp chỉ đã trừ được xây dựng trong.) Dòng thứ hai định nghĩa chức năng thực tế của chúng tôi, trong đó có một đĩa đơn inputvà trả về kết quả của việc sqrtvới nbắt đầu từ 1.


Nếu bạn muốn thêm {}[] bạn có thể thêm Brain-Flak. Đây là chương trình
Wheat Wizard

3

6 ngôn ngữ

Sử dụng retun flosq(agm1)\,ivà mở rộng các điểm mã B1BCcho 22 byte cho đến nay.

Ngôn ngữ trò chơi

return floor(sqrt(argument1))

Pyke

,1f

Julia

isqrt

Cây phong

(isqrt)

Bị mắc kẹt

i\

TI-Basic (bãi chứa hex)

B1 BC 72

Lưu ý rằng 0x72 là rtrong ASCII.


Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.