結果

問題 No.346 チワワ数え上げ問題
ユーザー ねずねず
提出日時 2018-01-27 07:11:05
言語 PHP
(843.2)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 4,692 ms
コンパイル使用メモリ 32,020 KB
実行使用メモリ 31,592 KB
最終ジャッジ日時 2024-12-28 09:14:05
合計ジャッジ時間 6,937 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$s = trim(fgets(STDIN));
$cntW = 0;
$ans = 0;
for ($i = strlen($s) - 1; $i >= 0; $i--) {
	if ($s[$i] == 'w') {
		$cntW++;
		continue;
	} else if ($s[$i] == 'c') {
		$ans += $cntW * ($cntW - 1) / 2;
	}
}
print $ans;
?>
0