結果

問題 No.9000 Hello World! (テスト用)
ユーザー arito_asu
提出日時 2026-11-05 06:45:11
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 957 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 368 ms
コンパイル使用メモリ 14,848 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2026-11-05 06:45:13
合計ジャッジ時間 2,001 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def bf_compiler(code):
    mem = [0] * 30000
    ptr = head = 0
    output = ""

    while head < len(code):
        c = code[head]

        if c == '+': mem[ptr] += 1
        elif c == '-': mem[ptr] -= 1
        elif c == '>': ptr += 1
        elif c == '<': ptr -= 1
        elif c == '.': output += chr(mem[ptr])
        # ',' has been disabled

        elif c == '[' and mem[ptr] == 0:
            count = 1
            while count:
                head += 1
                if code[head] == '[': count += 1
                elif code[head] == ']': count -= 1

        elif c == ']' and mem[ptr] != 0:
            count = 1
            while count:
                head -= 1
                if code[head] == ']': count += 1
                elif code[head] == '[': count -= 1

        head += 1

    return output
    
hw = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."
print(bf_compiler(hw))
0