結果
| 問題 | No.1196 A lazy student |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 16:26:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 982 bytes |
| 記録 | |
| コンパイル時間 | 107 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 17,140 KB |
| 最終ジャッジ日時 | 2024-10-15 10:27:04 |
| 合計ジャッジ時間 | 3,051 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 TLE * 1 -- * 8 |
ソースコード
import sys
sys.setrecursionlimit(4000000)
N = int(input())
P, Q, R = map(float, input().split())
class vec:
def __init__(self, x):
self.x = x
def __and__(self, other):
p = vec(self.x * other.x * (1.0 - R) + (1.0 - self.x * other.x) * R)
return p
def __or__(self, other):
p = vec(
(1.0 - (1.0 - self.x) * (1.0 - other.x)) * (1.0 - R)
+ (1.0 - self.x) * (1.0 - other.x) * R
)
return p
def RA(a, b):
p = vec(a.x * b.x * P + (1.0 - a.x * b.x) * Q)
return p
y = vec(1.0)
n = vec(0.0)
S = input()
T = S[0]
for i in range(len(S) - 1):
if S[i] == "S" or S[i] == "O" 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]
T = (
T.replace("random", "RA")
.replace("and", "&")
.replace("or", "|")
.replace("YES", "y ")
.replace("NO", "n ")
)
s = eval(T)
print(int(s.x * 100.0))