lcp17

package
v0.0.0-...-b071cee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

README

LCP 17.速算机器人

1. 题目描述

小扣在秋日市集发现了一款速算机器人。店家对机器人说出两个数字(记作 xy),请小扣说出计算指令:

  • "A" 运算:使 x = 2 * x + y
  • "B" 运算:使 y = 2 * y + x

在本次游戏中,店家说出的数字为 x = 1y = 0,小扣说出的计算指令记作仅由大写字母 AB 组成的字符串 s,字符串中字符的顺序表示计算顺序,请返回最终 xy 的和为多少。

示例 1:

输入:s = "AB"

输出:4

解释: 经过一次 A 运算后,x = 2, y = 0。 再经过一次 B 运算,x = 2, y = 2。 最终 x 与 y 之和为 4。

提示:

  • 0 <= s.length <= 10
  • s'A''B' 组成

标签 数学 字符串 模拟

2. 解题

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL