結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2018-04-14 16:38:03
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,635 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 8,470 ms
コンパイル使用メモリ 246,188 KB
実行使用メモリ 74,348 KB
最終ジャッジ日時 2023-09-12 18:15:43
合計ジャッジ時間 23,540 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 927 ms
61,880 KB
testcase_01 AC 943 ms
61,592 KB
testcase_02 AC 934 ms
61,968 KB
testcase_03 AC 946 ms
61,768 KB
testcase_04 AC 992 ms
62,024 KB
testcase_05 AC 1,239 ms
68,364 KB
testcase_06 AC 1,540 ms
74,348 KB
testcase_07 AC 1,635 ms
74,156 KB
testcase_08 AC 1,479 ms
74,044 KB
testcase_09 AC 1,387 ms
72,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

object Main {

	def main(arg:Array[String]) = {
		val list = scala.io.StdIn.readLine().toList;

		var num_o = countChar(list, 'o');
		var num_x = countChar(list, 'x');

		for (c <- list) {
			println(100.0 * num_o / (num_x + num_o));
			if (c == 'o') num_o -= 1;
			else num_x -= 1;
		}
	}

	def countChar(list:List[Char], aim:Char):Int = {
		var cnt = 0;
		for (c <- list) {
			if (c == aim) cnt += 1;
		}
		return cnt;
	}

}
0