結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-10-01 22:23:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,494 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 74,492 KB
実行使用メモリ 59,300 KB
最終ジャッジ日時 2024-04-20 14:22:56
合計ジャッジ時間 9,177 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
39,896 KB
testcase_01 AC 112 ms
41,380 KB
testcase_02 AC 105 ms
40,240 KB
testcase_03 AC 132 ms
41,584 KB
testcase_04 AC 233 ms
42,760 KB
testcase_05 AC 449 ms
51,012 KB
testcase_06 AC 1,020 ms
55,720 KB
testcase_07 AC 1,447 ms
59,300 KB
testcase_08 AC 1,494 ms
59,260 KB
testcase_09 AC 1,390 ms
58,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int n = s.length();
        int count_safe = 0;
        int count_out = 0;
        for(int i=0; i<n; i++) {
            char c = s.charAt(i);
            if(c == 'o') count_safe++;
            if(c == 'x') count_out++;
        }

        char b = 's';
        for(int i=0; i<n; i++) {
            if(b == 'o') count_safe--;
            if(b == 'x') count_out--;

            int zan = n - i;
            System.out.printf("%.13f\n", ((double)count_safe / zan) * 100.0);

            b = s.charAt(i);
        }
    }
}
0