結果

問題 No.1196 A lazy student
ユーザー Shuz*Shuz*
提出日時 2020-08-22 16:31:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 930 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,604 KB
実行使用メモリ 139,316 KB
最終ジャッジ日時 2024-04-23 10:35:40
合計ジャッジ時間 3,043 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
59,796 KB
testcase_01 AC 37 ms
53,560 KB
testcase_02 AC 36 ms
52,328 KB
testcase_03 AC 40 ms
61,536 KB
testcase_04 AC 57 ms
75,728 KB
testcase_05 AC 59 ms
75,396 KB
testcase_06 AC 41 ms
62,468 KB
testcase_07 AC 54 ms
76,964 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
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 RA(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", "RA")
    .replace("and", "&")
    .replace("or", "|")
    .replace("YES", "y ")
    .replace("NO", "n ")
)
T = S[0]

for i in range(len(S) - 1):
    if S[i] == " " or S[i] == ")":
        if S[i + 1] == "y" or S[i + 1] == "n" or S[i + 1] == "(" or S[i + 1] == "R":
            T += ","
    T += S[i + 1]


s = eval(T)

print(int(s.x * 100.0))

0