結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2015-04-26 22:37:24 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 34 ms / 5,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 3,157 ms |
コンパイル使用メモリ | 31,764 KB |
実行使用メモリ | 32,532 KB |
最終ジャッジ日時 | 2024-07-07 05:40:38 |
合計ジャッジ時間 | 4,166 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php$table = ['A', 'B', 'C', 'D','E', 'F', 'G', 'H','I', 'J', 'K', 'L','M', 'N', 'O', 'P','Q', 'R', 'S', 'T','U', 'V', 'W', 'X','Y', 'Z'];main();function main() {$S = trim(fgets(STDIN));$decrypt = "";for($i = 0, $len = strlen($S); $i < $len; $i++) {$decrypt .= decryptChar($S[$i], $i + 1);}echo $decrypt . "\n";}function decryptChar($c, $N) {global $table;$inverse = array_flip($table);$i = $inverse[$c];$key = ($i + 26 - $N % 26) % 26;return $table[$key];}