結果

問題 No.667 Mice's Luck(ネズミ達の運)
コンテスト
ユーザー srup٩(๑`н´๑)۶
提出日時 2018-04-14 16:38:03
言語 Scala(Beta)
(3.8.1)
コンパイル:
scalac _filename_
実行:
java -cp .:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala3-library_3/3.8.1/scala3-library_3-3.8.1.jar:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala-library/3.8.1/scala-library-3.8.1.jar _class_
結果
AC  
実行時間 543 ms / 2,000 ms
コード長 427 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 6,444 ms
コンパイル使用メモリ 255,896 KB
実行使用メモリ 69,156 KB
最終ジャッジ日時 2026-03-09 15:36:07
合計ジャッジ時間 11,887 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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