aboutsummaryrefslogtreecommitdiffhomepage
path: root/archive/q/brainf-ck/a/95/index.html
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-12-05 04:08:22 +0900
committernsfisis <nsfisis@gmail.com>2025-12-05 04:08:22 +0900
commitfbd4f2129ce8fe106391302896dd86e05b2f331b (patch)
tree3be97d86c89a4a8a497e1b8a2d7d032eb153438e /archive/q/brainf-ck/a/95/index.html
parentca3f1c4b0bd08ab6e836923601cf699d1fd894fb (diff)
downloadphperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.tar.gz
phperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.tar.zst
phperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.zip
add files
Diffstat (limited to 'archive/q/brainf-ck/a/95/index.html')
-rw-r--r--archive/q/brainf-ck/a/95/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/archive/q/brainf-ck/a/95/index.html b/archive/q/brainf-ck/a/95/index.html
new file mode 100644
index 0000000..f9f47a5
--- /dev/null
+++ b/archive/q/brainf-ck/a/95/index.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>問題 #3 - 回答 #95 | Albatross.PHP</title>
+ <link rel="stylesheet" href="../../../../assets/index.css">
+ <link rel="icon" type="image/svg+xml" href="../../../../assets/favicon.svg">
+ <script type="module" src="../../../../assets/index.js"></script>
+ </head>
+ <body>
+ <header class="container">
+ <nav class="navbar">
+ <a class="navbar-brand" href="../../../../index.html">Albatross.PHP</a>
+ </nav>
+ </header>
+ <main class="container mt-5">
+ <h1 class="mb-4">問題 #3 - 回答 #95</h1>
+ <nav>
+ <ol class="breadcrumb">
+ <li class="breadcrumb-item"><a href="../../../../index.html">問題一覧</a></li>
+ <li class="breadcrumb-item"><a href="../../index.html">Brainf*ck</a></li>
+ <li class="breadcrumb-item"><a href="../index.html">回答一覧</a></li>
+ <li class="breadcrumb-item active">#95</li>
+ </ol>
+ </nav>
+
+ <h2>Brainf*ck</h2>
+ <p>
+ Brainf*ck を実装してください。標準入力から Brainf*ck のソースコードが渡されます。Brainf*ck の仕様のうち、入力命令である「,」は未実装で構いません。
+
+一部明確に挙動が定められていない部分については、以下の仕様とします。
+メモリの各セルは 8 bit の符号なし整数です。今回の入力でオーバーフローは発生しません。
+メモリのアドレスは非負整数です。今回の入力で負のアドレスへポインタを動かすことはありません。
+Brainf*ck に存在する命令以外の文字を受け取った場合は無視してください。
+今回の入力に不正なプログラムは含まれません。すなわち、「[」と「]」は必ず釣り合っています。
+ </p>
+ <h2>回答 #95</h2>
+ <p>
+ tsbkw が 2024-03-09 11:54:17 に投稿
+ </p>
+ <h2>コード</h2>
+ <p>
+ 380 byte
+ </p>
+ <pre><code class="hljs language-php">&lt;?=($s=fgets(STDIN))&amp;&amp;$m=[]&amp;&amp;$p=0&amp;&amp;array_map(fn($c)=&gt;$c===&#039;&gt;&#039;?$p++:$c===&#039;&lt;&#039;?$p--:$c===&#039;+&#039;?($m[$p]??0)++:$c===&#039;-&#039;?($m[$p]??0)--:$c===&#039;.&#039;?print chr($m[$p]):$c===&#039;[&#039;&amp;&amp;(!$m[$p]&amp;&amp;$d=1)&amp;&amp;array_map(fn($c)=&gt;$d+=($c==&#039;]&#039;)-($c==&#039;[&#039;),str_split($s))||$c===&#039;]&#039;&amp;&amp;$m[$p]&amp;&amp;($d=1)&amp;&amp;array_map(fn($c)=&gt;$d-=($c==&#039;]&#039;)-($c==&#039;[&#039;),array_slice(array_reverse(str_split(substr($s,0,strpos($s,&#039;]&#039;)+1))),1));```</code></pre>
+ <h2>実行結果</h2>
+ <div class="js-phper-token">
+ </div>
+ <div class="mt-3">
+ ステータス: <span class="js-aggregated-execution-status" data-answer-id="492">失敗</span>
+ </div>
+ <div class="mt-3">
+ <h3>テストケース 1</h3>
+ <div>
+ ステータス: <span class="js-testcase-execution-status" data-testcase-execution-id="1130">実行時エラー</span>
+ </div>
+ <h4>標準出力</h4>
+ <pre><code class="js-testcase-execution-stdout hljs language-plaintext" data-testcase-execution-id="1130">
+Parse error: syntax error, unexpected token &quot;=&quot;, expecting end of file in php.wasm code on line 6
+
+</code></pre>
+ <h4>標準エラー出力</h4>
+ <pre><code class="js-testcase-execution-stderr hljs language-plaintext" data-testcase-execution-id="1130">
+</code></pre>
+ <h3>テストケース 2</h3>
+ <div>
+ ステータス: <span class="js-testcase-execution-status" data-testcase-execution-id="1131">実行時エラー</span>
+ </div>
+ <h4>標準出力</h4>
+ <pre><code class="js-testcase-execution-stdout hljs language-plaintext" data-testcase-execution-id="1131">
+Parse error: syntax error, unexpected token &quot;=&quot;, expecting end of file in php.wasm code on line 6
+
+</code></pre>
+ <h4>標準エラー出力</h4>
+ <pre><code class="js-testcase-execution-stderr hljs language-plaintext" data-testcase-execution-id="1131">
+</code></pre>
+ <h3>テストケース 3</h3>
+ <div>
+ ステータス: <span class="js-testcase-execution-status" data-testcase-execution-id="1132">実行時エラー</span>
+ </div>
+ <h4>標準出力</h4>
+ <pre><code class="js-testcase-execution-stdout hljs language-plaintext" data-testcase-execution-id="1132">
+Parse error: syntax error, unexpected token &quot;=&quot;, expecting end of file in php.wasm code on line 6
+
+</code></pre>
+ <h4>標準エラー出力</h4>
+ <pre><code class="js-testcase-execution-stderr hljs language-plaintext" data-testcase-execution-id="1132">
+</code></pre>
+ </div>
+ <script type="module" src="../../../../assets/loading.js"></script>
+ </main>
+ <footer class="container text-center mt-5 mb-4">
+ Albatross.PHP - PHPerKaigi 2024
+ </footer>
+ </body>
+</html>