結果
問題 | No.193 筒の数式 |
ユーザー | papinianus |
提出日時 | 2016-08-31 09:28:24 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 43 ms / 1,000 ms |
コード長 | 434 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 32,016 KB |
実行使用メモリ | 32,788 KB |
最終ジャッジ日時 | 2024-11-14 12:53:30 |
合計ジャッジ時間 | 2,090 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $str = trim(fgets(STDIN)); $strlen = strlen($str); $str .= $str; $ans = []; for($i = 0; $i < $strlen; $i++) { if(in_array($str[$i],["+","-"],true) || in_array($str[$i+$strlen-1],["+","-"],true) ) { continue; } $formula = substr($str, $i, $strlen); $formula = preg_replace('/([+-])0(.+)/','${1}${2}',$formula); //0で始まる数値が8進数になる eval('$ans[] = '.$formula.';'); } echo max($ans);