結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー Pump0129Pump0129
提出日時 2018-03-27 00:11:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 943 ms / 2,000 ms
コード長 1,066 bytes
コンパイル時間 2,666 ms
コンパイル使用メモリ 89,828 KB
実行使用メモリ 74,280 KB
最終ジャッジ日時 2023-09-07 18:39:42
合計ジャッジ時間 9,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,452 KB
testcase_01 AC 132 ms
55,708 KB
testcase_02 AC 131 ms
56,044 KB
testcase_03 AC 139 ms
55,908 KB
testcase_04 AC 197 ms
56,276 KB
testcase_05 AC 345 ms
58,160 KB
testcase_06 AC 648 ms
64,180 KB
testcase_07 AC 943 ms
74,280 KB
testcase_08 AC 895 ms
73,952 KB
testcase_09 AC 861 ms
74,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package net.ipipip0129.yukicoder.no667;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        List<String> boxlist = Arrays.asList(scan.nextLine().split(""));

        int passCount = boxlist.stream()
                .filter(s -> s.startsWith("o"))
                .collect(Collectors.toList())
                .size();
        int trapCount = boxlist.stream()
                .filter(s -> s.startsWith("x"))
                .collect(Collectors.toList())
                .size();

        for (String box : boxlist) {
            System.out.println(((double) passCount / (double) (passCount + trapCount)) * 100);
            switch (box.charAt(0)) {
                case 'o':
                    passCount--;
                    break;
                case 'x':
                    trapCount--;
                    break;
            }
        }
    }
}
0