結果

問題 No.346 チワワ数え上げ問題
ユーザー hu_nbk
提出日時 2016-02-29 02:54:00
言語 PHP
(843.2)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 5,700 ms
コンパイル使用メモリ 32,016 KB
実行使用メモリ 32,532 KB
最終ジャッジ日時 2024-09-24 12:38:44
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$sum=0;
$wcount =0;
$in = trim(fgets(STDIN));
for($i=0;$i<strlen($in);$i++){
    $current = strlen($in)-$i-1;
    if($in[$current]=="w"){$wcount++;}
    else if($in[$current]=="c"){
        $temp=1;
        for($j=$wcount;$j>$wcount-2;$j--){$temp*=$j;}
        $temp/=2;
        $sum+=$temp;
    }
}
print $sum;
0