結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2016-03-17 21:27:54 |
言語 | PHP (843.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 429 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 32,272 KB |
実行使用メモリ | 43,736 KB |
最終ジャッジ日時 | 2024-10-01 08:52:52 |
合計ジャッジ時間 | 7,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 21 TLE * 1 -- * 1 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $str = trim(fgets(STDIN)); $c_list = str_split($str); $cnt=0; for($i=0;$i<strlen($str);$i++){ if($c_list[$i] == 'c'){ $tg = substr($str, $i, strlen($str)-$i); if(substr_count($tg, 'w')>1){ $cnt += b_num(substr_count($tg, 'w')-1); } } } printf("$cnt"); function b_num($num){ $result=0; for($i=$num;$i>0;$i--){ $result+=$i; } return $result; }