結果

問題 No.805 UMG
ユーザー dyechidyechi
提出日時 2019-03-27 17:33:31
言語 PHP
(8.3.4)
結果
AC  
実行時間 734 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 32,016 KB
実行使用メモリ 31,348 KB
最終ジャッジ日時 2024-04-29 10:46:32
合計ジャッジ時間 7,403 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
31,276 KB
testcase_01 AC 37 ms
31,348 KB
testcase_02 AC 37 ms
31,084 KB
testcase_03 AC 37 ms
31,092 KB
testcase_04 AC 35 ms
30,900 KB
testcase_05 AC 35 ms
31,332 KB
testcase_06 AC 35 ms
31,228 KB
testcase_07 AC 35 ms
31,244 KB
testcase_08 AC 36 ms
31,180 KB
testcase_09 AC 37 ms
31,156 KB
testcase_10 AC 35 ms
31,316 KB
testcase_11 AC 35 ms
31,100 KB
testcase_12 AC 37 ms
31,348 KB
testcase_13 AC 38 ms
31,240 KB
testcase_14 AC 38 ms
31,108 KB
testcase_15 AC 54 ms
31,212 KB
testcase_16 AC 57 ms
31,184 KB
testcase_17 AC 50 ms
30,968 KB
testcase_18 AC 64 ms
30,956 KB
testcase_19 AC 47 ms
31,132 KB
testcase_20 AC 61 ms
31,160 KB
testcase_21 AC 50 ms
31,284 KB
testcase_22 AC 53 ms
31,220 KB
testcase_23 AC 734 ms
31,280 KB
testcase_24 AC 702 ms
31,084 KB
testcase_25 AC 716 ms
31,072 KB
testcase_26 AC 701 ms
31,220 KB
testcase_27 AC 725 ms
31,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
while ($line = fgets(STDIN)) {
	$array[] = trim($line);
}
$length = array_splice($array, 0, 1);
$words = str_split($array[0]);

$answer = 0;
for ($i=0; $i<$length[0]; $i++) {
	for ($j=0; $j<floor(($length[0]-$i+1)/2); $j++) {
		if ($words[$i] == "U") {
			if ($words[$i+$j] == "M" and $words[$i+2*$j] == "G") {
				$answer++;
			}
		}
	}
}
echo $answer.PHP_EOL;
?>
0