結果

問題 No.1196 A lazy student
ユーザー Shuz*Shuz*
提出日時 2020-08-22 16:52:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 839,888 KB
最終ジャッジ日時 2024-04-23 10:58:45
合計ジャッジ時間 4,336 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 MLE -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(1000000)

N = int(input())
P, Q, R = map(float, input().split())


class vec:
    def __init__(self, x):
        self.x = x

    def __and__(self, other):
        return vec(self.x * other.x * (1.0 - R) + (1.0 - self.x * other.x) * R)

    def __or__(self, other):
        return vec(
            (1.0 - (1.0 - self.x) * (1.0 - other.x)) * (1.0 - R)
            + (1.0 - self.x) * (1.0 - other.x) * R
        )


def r(a, b):
    return vec(a.x * b.x * P + (1.0 - a.x * b.x) * Q)


y = vec(1.0)
n = vec(0.0)

S = (
    input()
    .replace("random", "r")
    .replace("and", "&")
    .replace("or", "|")
    .replace("YES", "y ")
    .replace("NO", "n ")
    .replace(" y", " ,y")
    .replace(" n", " ,n")
    .replace(" (", " ,(")
    .replace(" r", " ,r")
    .replace(")r", "),r")
    .replace(")n", "),n")
    .replace(")(", "),(")
    .replace(")r", "),r")
)

print(S)
s = eval(S)

print(int(s.x * 100.0))

0