From fbd4f2129ce8fe106391302896dd86e05b2f331b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 5 Dec 2025 04:08:22 +0900 Subject: add files --- archive/q/base32/a/15/index.html | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 archive/q/base32/a/15/index.html (limited to 'archive/q/base32/a/15/index.html') diff --git a/archive/q/base32/a/15/index.html b/archive/q/base32/a/15/index.html new file mode 100644 index 0000000..019c2a8 --- /dev/null +++ b/archive/q/base32/a/15/index.html @@ -0,0 +1,116 @@ + + + + + 問題 #2 - 回答 #15 | Albatross.PHP + + + + + +
+ +
+
+

問題 #2 - 回答 #15

+ + +

Base32

+

+ RFC 4648 で定義された Base32 エンコーディングを実装してください。 +標準入力から与えられる各行に対し、Base32 エンコードをおこなった文字列を標準出力へ改行区切りで出力してください。 +なお、アルファベットの出力には大文字を用いてください。 +

+

回答 #15

+

+ tadsan が 2024-03-07 16:51:13 に投稿 +

+

コード

+

+ 288 byte +

+
while($l=fgets(STDIN)){$l=chop($l);$t='';for($i=0;$i<strlen($l);$i++)$t.=srt_pad(decbin(ord($l[$i]),8,0,0));echo join(array_map(fn($b)=>[...range('A','Z'),...range('2','7')][bindec(str_pad($b,5,'0'))],str_split($t, 5))),[8=>'======',16=>'====',24=>'===',32=>'='][strlen($t)%40]??'',"\n";}
+

実行結果

+
+
+
+ ステータス: 失敗 +
+
+

テストケース 1

+
+ ステータス: 実行時エラー +
+

標準出力

+

+Fatal error: Uncaught Error: Call to undefined function srt_pad() in php.wasm code:6
+Stack trace:
+#0 {main}
+  thrown in php.wasm code on line 6
+
+
+

標準エラー出力

+

+
+

テストケース 2

+
+ ステータス: 実行時エラー +
+

標準出力

+

+Fatal error: Uncaught Error: Call to undefined function srt_pad() in php.wasm code:6
+Stack trace:
+#0 {main}
+  thrown in php.wasm code on line 6
+
+
+

標準エラー出力

+

+
+

テストケース 3

+
+ ステータス: 実行時エラー +
+

標準出力

+

+Fatal error: Uncaught Error: Call to undefined function srt_pad() in php.wasm code:6
+Stack trace:
+#0 {main}
+  thrown in php.wasm code on line 6
+
+
+

標準エラー出力

+

+
+

テストケース 4

+
+ ステータス: 実行時エラー +
+

標準出力

+

+Fatal error: Uncaught Error: Call to undefined function srt_pad() in php.wasm code:6
+Stack trace:
+#0 {main}
+  thrown in php.wasm code on line 6
+
+
+

標準エラー出力

+

+
+
+ +
+ + + -- cgit v1.2.3-70-g09d2