結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
重荷
|
| 提出日時 | 2016-03-17 21:27:54 |
| 言語 | PHP (8.5.4) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 429 bytes |
| 記録 | |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 36,652 KB |
| 実行使用メモリ | 47,596 KB |
| 最終ジャッジ日時 | 2026-04-17 09:25:13 |
| 合計ジャッジ時間 | 6,209 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
重荷