結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
ねず
|
| 提出日時 | 2018-01-27 07:09:30 |
| 言語 | PHP (843.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 193 bytes |
| コンパイル時間 | 4,192 ms |
| コンパイル使用メモリ | 32,016 KB |
| 実行使用メモリ | 32,656 KB |
| 最終ジャッジ日時 | 2024-12-28 09:13:54 |
| 合計ジャッジ時間 | 6,731 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 4 WA * 19 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
$s = trim(fgets(STDIN));
$cntW = 0;
$ans = 0;
for ($i = strlen($s) - 1; $i >= 0; $i--) {
if ($s[$i] == 'w') {
$cntW++;
continue;
}
$ans += $cntW * ($cntW - 1) / 2;
}
print $ans;
?>
ねず