mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-24 00:57:05 +08:00
27 lines
528 B
Markdown
27 lines
528 B
Markdown
|
|
# 112. 挑战boss
|
|
|
|
本题题意有点绕,注意看一下 题目描述中的【提示信息】,但是在笔试中,是不给这样的提示信息的。
|
|
|
|
简单模拟:
|
|
|
|
```CPP
|
|
#include<iostream>
|
|
using namespace std;
|
|
int main() {
|
|
int n, a, b, k = 0;
|
|
cin >> n >> a >> b;
|
|
string s;
|
|
cin >> s;
|
|
int result = 0;
|
|
for (int i = 0; i < s.size(); i++) {
|
|
int cur = a + k * b;
|
|
result += cur;
|
|
++k;
|
|
if (s[i] == 'x') k = 0;
|
|
}
|
|
cout << result << endl;
|
|
return 0;
|
|
}
|
|
```
|