結果

問題 No.672 最長AB列
ユーザー dong_fengdong_feng
提出日時 2018-04-19 22:57:28
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 18,568 KB
実行使用メモリ 52,120 KB
最終ジャッジ日時 2023-09-10 04:41:55
合計ジャッジ時間 5,256 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
18,944 KB
testcase_02 AC 15 ms
19,000 KB
testcase_03 WA -
testcase_04 AC 15 ms
18,948 KB
testcase_05 WA -
testcase_06 AC 15 ms
18,792 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

//取得
$charList = str_split(fgets(STDIN), 1);
$listCount = count($charList);

//処理
for($i=$listCount; $i>0; $i--){//文字列を切る長さのループ
	if($i%2==0){	//奇数文字の文字列はやる意味がない
		for($j=0; $j<($listCount-$i+1); $j++){	//文字列のスタート位置を決めるループ
			$count = 0; //Aの個数をカウントしてくれる
			for($k=$j; $k<$i; $k++){	//切り出した文字列を回すループ
				if($charList[$k]=='A') $count ++;
			}
			if($count == $i/2) {
				echo $i.PHP_EOL;
				exit;
			}
		}
	}
}

echo "0".PHP_EOL;
0