diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-17 01:35:04 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-17 01:35:04 +0900 |
| commit | 0766039bd9e6b9f5e6334e84666f5be698d41fc3 (patch) | |
| tree | 0f3a52fdbf56496850f903d64dcf7725fb0aedbe /public/posts/2022-08-27 | |
| parent | ee72f8780cf3681e4202cc3a6358fb4038db1ec8 (diff) | |
| download | blog.nsfisis.dev-0766039bd9e6b9f5e6334e84666f5be698d41fc3.tar.gz blog.nsfisis.dev-0766039bd9e6b9f5e6334e84666f5be698d41fc3.tar.zst blog.nsfisis.dev-0766039bd9e6b9f5e6334e84666f5be698d41fc3.zip | |
feat(nuldoc): implement syntax highlight
Diffstat (limited to 'public/posts/2022-08-27')
| -rw-r--r-- | public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html b/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html index 851f76c..1e124bf 100644 --- a/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html +++ b/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html @@ -10,7 +10,7 @@ <link rel="icon" type="image/svg+xml" href="/favicon.svg"> <title>PHP カンファレンス沖縄で出題されたコードゴルフの問題を解いてみた | REPL: Rest-Eat-Program Loop</title> <link rel="stylesheet" href="/style.css?h=17cf97a767ec5fb6e64967729f40f30a"> - <link rel="stylesheet" href="/hl.css?h=208c52e3b7c9db1cad782c5d30b4698f"> + <link rel="stylesheet" href="/hl.css?h=340e65ffd5c17713efc9107c06304f7b"> </head> <body class="single"> <header class="header"> @@ -121,7 +121,7 @@ 書いたものがこちら: </p> - <pre class="highlight" language="php" linenumbering="unnumbered"><code>[<?php $n=$argv[1];foreach([1e4,5e3,2e3,1e3,500,100,50,10,5,1]as$x)for(;$n>=$x;$n-=$x)$r[]=$x;echo implode(', ',$r??[]);?>]</code></pre> + <pre class="highlight" language="php" linenumbering="unnumbered"><code class="highlight">[<span class="hljs-meta"><?php</span> <span class="hljs-variable">$n</span>=<span class="hljs-variable">$argv</span>[<span class="hljs-number">1</span>];<span class="hljs-keyword">foreach</span>([<span class="hljs-number">1e4</span>,<span class="hljs-number">5e3</span>,<span class="hljs-number">2e3</span>,<span class="hljs-number">1e3</span>,<span class="hljs-number">500</span>,<span class="hljs-number">100</span>,<span class="hljs-number">50</span>,<span class="hljs-number">10</span>,<span class="hljs-number">5</span>,<span class="hljs-number">1</span>]<span class="hljs-keyword">as</span><span class="hljs-variable">$x</span>)<span class="hljs-keyword">for</span>(;<span class="hljs-variable">$n</span>>=<span class="hljs-variable">$x</span>;<span class="hljs-variable">$n</span>-=<span class="hljs-variable">$x</span>)<span class="hljs-variable">$r</span>[]=<span class="hljs-variable">$x</span>;<span class="hljs-keyword">echo</span> <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">', '</span>,<span class="hljs-variable">$r</span>??[]);<span class="hljs-meta">?></span>]</code></pre> <p> しめて 123 バイトとなった (末尾改行を含めずにカウント)。 @@ -131,15 +131,15 @@ こちらは改行とスペースを追加したバージョン: </p> - <pre class="highlight" language="php" linenumbering="unnumbered"><code>[<?php + <pre class="highlight" language="php" linenumbering="unnumbered"><code class="highlight">[<span class="hljs-meta"><?php</span> - $n = $argv[1]; - foreach ([1e4, 5e3, 2e3, 1e3, 500, 100, 50, 10, 5, 1] as $x) - for (; $n >= $x; $n -= $x) - $r[] = $x; - echo implode(', ', $r ?? []); + <span class="hljs-variable">$n</span> = <span class="hljs-variable">$argv</span>[<span class="hljs-number">1</span>]; + <span class="hljs-keyword">foreach</span> ([<span class="hljs-number">1e4</span>, <span class="hljs-number">5e3</span>, <span class="hljs-number">2e3</span>, <span class="hljs-number">1e3</span>, <span class="hljs-number">500</span>, <span class="hljs-number">100</span>, <span class="hljs-number">50</span>, <span class="hljs-number">10</span>, <span class="hljs-number">5</span>, <span class="hljs-number">1</span>] <span class="hljs-keyword">as</span> <span class="hljs-variable">$x</span>) + <span class="hljs-keyword">for</span> (; <span class="hljs-variable">$n</span> >= <span class="hljs-variable">$x</span>; <span class="hljs-variable">$n</span> -= <span class="hljs-variable">$x</span>) + <span class="hljs-variable">$r</span>[] = <span class="hljs-variable">$x</span>; + <span class="hljs-keyword">echo</span> <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">', '</span>, <span class="hljs-variable">$r</span> ?? []); - ?>]</code></pre> + <span class="hljs-meta">?></span>]</code></pre> </section> <section id="section--_使用したテクニック"> |
