結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
|
提出日時 | 2016-09-06 12:49:56 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 5,542 ms |
コンパイル使用メモリ | 30,700 KB |
実行使用メモリ | 31,344 KB |
最終ジャッジ日時 | 2024-12-23 00:42:47 |
合計ジャッジ時間 | 5,650 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $strs = trim(fgets(STDIN)); $cnt = array_count_values(str_split($strs)); $len = strlen($strs); $prod = range(1, $len); $div = []; foreach($cnt as $i) { while($i > 1) { if(($pos = array_search($i, $prod))!==false) { unset($prod[$pos]); } else { $div[] = $i; } $i--; } } $ans = array_product($prod); if(count($div) > 0) { $ans /= array_product($div); } echo $ans - 1;