经典简约
清爽简洁,回归本真
液态水晶
毛玻璃+霓虹光带
赛博朋克
霓虹故障艺术风
🚫
违规操作检测
禁止使用右键菜单
⚠️ 此操作已被系统记录
1

Smeech

📝 题解 🔵 仅限 C++
题目描述
<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>
输入格式
<p> Please Input Input Here </p>
输出格式
<p> Please Input Output Here </p>
样例
样例输入 1
7 (.5 3 9) ()
样例输出 1
7.00 3.00
提交代码
请先登录后提交

🤖 AI 解题助手

DeepSeek
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这道题,可以帮你分析思路、提供代码示例。
⚠️ 请先登录后使用