-
Code # no cheating methods such as eval exec # has the same relevant chars (nothing hidden in comment) from __future__ import braces # 深紅心 is excited to see braces in python from operator import itemgetter from operator import getitem from operator import setitem from sys import stdout from sys import argv def kata(sin): class _: def __init__(self): pass def __lt__(*self): assert ptr mask = 1 while not ptr & mask: mask *= 2 mask |= 1 ptr ^= mask def __gt__(*self): ptr = abs(~ptr) def __iter__(self): return self def __next__(self): if not itemgetter(ptr)(tape): raise StopIteration def idxs(option): if type(option) == dict: for x in option: yield x yield from idxs(itemgetter(x)(option)) else: yield option tape = 30000 * list(range(1)) ptr = 0 sinptr = ~0 setitem(*reversed(tuple(idxs( {ord(getitem(sin, sinptr := abs(~sinptr))): {ptr: tape}})))) setitem(*reversed(tuple(idxs( {itemgetter(ptr)(tape) + 1 & 0xff: {ptr: tape}})))) [setitem(*reversed(tuple(idxs( {itemgetter(ptr)(tape) - 1 & 0xff: {ptr: tape}})))) or stdout.write(chr(itemgetter(ptr)(tape))) and False or setitem(*reversed(tuple(idxs( {ord(getitem(sin, sinptr := abs(~sinptr))): {ptr: tape}})))) or setitem(*reversed(tuple(idxs( {itemgetter(ptr)(tape) + 1 & 0xff: {ptr: tape}})))) for _0 in _()] if __name__ == "__main__": # pretty much stdin, right? right?? kata(itemgetter(1)(argv))
Test Cases // You can use the Mocha (JavaScript) framework for testing BF. // TODO: replace with your own tests (TDD), these are just here to demonstrate usage. describe("Your Test Suite", function () { it("should return Hello World!", function () { // use runBF() to run your program, you can pass it arguments Test.assertEquals(runBF("shen-hong-xin's cat program works properly"), "shen-hong-xin's cat program works properly"); }); });
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}