結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー htensaihtensai
提出日時 2019-11-13 08:49:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 3,001 ms
コンパイル使用メモリ 74,872 KB
実行使用メモリ 64,444 KB
最終ジャッジ日時 2023-10-21 19:37:13
合計ジャッジ時間 6,469 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,492 KB
testcase_01 AC 128 ms
57,380 KB
testcase_02 AC 126 ms
57,456 KB
testcase_03 AC 128 ms
57,232 KB
testcase_04 AC 143 ms
57,448 KB
testcase_05 AC 193 ms
59,680 KB
testcase_06 AC 269 ms
60,312 KB
testcase_07 AC 382 ms
64,444 KB
testcase_08 AC 294 ms
60,968 KB
testcase_09 AC 255 ms
60,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int out = 0;
		int safe = 0;
		for (char c : arr) {
		    if (c == 'o') {
		        safe++;
		    } else {
		        out++;
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < arr.length; i++) {
		    sb.append((double)safe / (safe + out) * 100).append("\n");
		    if (arr[i] == 'o') {
		        safe--;
		    } else {
		        out--;
		    }
		}
		System.out.print(sb);
   }
 }
0