Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

Smeech

📝 Solutions 🔵 仅限 C++
Problems Description
<p> Professor Octastichs has invented a new programming language, Smeech. An expression in Smeech may be a positive or negative integer, or may be of the form(<i>p</i> <i>e<sub>1</sub></i> <i>e<sub>2</sub></i>)where <i>p</i> is a real number between 0 and 1 (inclusive) and <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are Smeech expressions. The value represented by a Smeech expression is as follows: </p> <ul> <li> An integer represents itself </li> <li> With probability <i>p</i>,(<i>p</i> <i>e<sub>1</sub></i> <i>e<sub>2</sub></i>)represents <i>x+y</i> where <i>x</i> is the value of <i>e<sub>1</sub></i> and <i>y</i> is the value of <i>e<sub>2</sub></i>; otherwise it represents <i>x-y</i>. </li> </ul> <p> Given a Smeech expression, what is its expected value? </p> <p> Input consists of several Smeech expressions, one per line, followed by a line containing (). For each expression, output its expected value to two decimal places. </p>
Input格式
<p> Please Input Input Here </p>
Output格式
<p> Please Input Output Here </p>
Sample
Sample Input 1
7 (.5 3 9) ()
Sample Output 1
7.00 3.00
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token