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/59/index.html | 126 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 archive/q/base32/a/59/index.html (limited to 'archive/q/base32/a/59/index.html') diff --git a/archive/q/base32/a/59/index.html b/archive/q/base32/a/59/index.html new file mode 100644 index 0000000..db0fc92 --- /dev/null +++ b/archive/q/base32/a/59/index.html @@ -0,0 +1,126 @@ + + + + + 問題 #2 - 回答 #59 | Albatross.PHP + + + + + +
+ +
+
+

問題 #2 - 回答 #59

+ + +

Base32

+

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

+

回答 #59

+

+ tadsan が 2024-03-08 04:56:22 に投稿 +

+

コード

+

+ 280 byte +

+
while($l=fgets(STDIN)){$l=chop($l);$t='';for(;@$i++<strlen($l);)$t.=str_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

+
+ ステータス: 不正解 +
+

標準出力

+

+Warning: Uninitialized string offset 4 in php.wasm code on line 6
+N5TWKAA=
+
+
+
+
+

標準エラー出力

+

+
+

テストケース 2

+
+ ステータス: 不正解 +
+

標準出力

+

+Warning: Uninitialized string offset 15 in php.wasm code on line 6
+QGDOHAML4OBIVY4BV7RYDEQA
+
+
+
+
+

標準エラー出力

+

+
+

テストケース 3

+
+ ステータス: 不正解 +
+

標準出力

+

+Warning: Uninitialized string offset 7 in php.wasm code on line 6
+GIZTINJWG4AA====
+
+
+Warning: Uninitialized string offset 10 in php.wasm code on line 6
+AA======
+
+
+
+
+
+
+
+
+
+

標準エラー出力

+

+
+

テストケース 4

+
+ ステータス: 不正解 +
+

標準出力

+

+Warning: Uninitialized string offset 5 in php.wasm code on line 6
+EBRCAYYA
+
+Warning: Uninitialized string offset 20 in php.wasm code on line 6
+QQQOHAMGEDRYDCBA4OAYUAA=
+
+
+

標準エラー出力

+

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