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

Logo 2

📝 Solutions 🔵 仅限 C++
Problems Description
<p>Logo is a programming language built around a turtle. Commands in the language cause the turtle to move. The turtle has a pen attached to it. As the turtle moves, it draw lines on the page. The turtle can be programmed to draw interesting pictures.</p> <p>We are interested in making the turtle draw a picture, then return to the point that it started from. For example, we could give the turtle the following program:</p> <p><tt>fd 100 lt 120 fd 100 lt 120 fd 100</tt></p> <p>The command <tt>fd</tt> causes the turtle to move forward by the specified number of units. The command <tt>lt</tt> causes the turtle to turn left by the specified number of degrees. Thus the above commands cause the turtle to draw an equilateral triangle with sides 100 units long. Notice that after executing the commands, the turtle ends up in the same place as it started. The turtle understands two additional commands. The command <tt>bk</tt> causes the turtle to move backward by the specified number of units. The command <tt>rt</tt> causes the turtle to turn right by the specified number of degrees. The distances and angles in all commands are always non-negative integers.</p> <p>Unfortunately, we have been messy in writing the program down, and cannot read our own writing. One of the numbers in the program is missing. Assuming the turtle ends up at the place that it started at the end of its journey, can you find the missing number?</p>
Input格式
<p>The first line of input contains one integer specifying the number of test cases to follow. Each test case starts with a line containing one integer, the number of commands to follow. The commands follow, one on each line. Each test case will contain no more than 1000 commands. The argument of each command is either an integer or a question mark (?). There will be exactly one question mark in each test case.</p>
Output格式
<p>For each test case, output line containing a single integer</p> <i>n</i> <p>such that when the question mark in the program is replaced by</p> <i>n</i> <p>, the turtle ends up at the same point that it started from once the program completes. If the question mark is the argument of an</p> <tt>lt</tt> <p>or</p> <tt>rt</tt> <p>command, the angle in the output must be between 0 and 359 degrees, inclusive. The correct answer will always be an integer, and we guarantee that for every test case, there will be only one correct answer.</p>
Sample
Sample Input 1
1 5 fd 100 lt 120 fd ? lt 120 fd 100
Sample Output 1
100
Submit Code
请先Login后Submit

🤖 AI 解题助手

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