結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー matsuyoshi30
提出日時 2018-10-01 22:23:21
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,602 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 74,384 KB
実行使用メモリ 59,304 KB
最終ジャッジ日時 2024-10-12 09:54:55
合計ジャッジ時間 10,189 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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