本文主要是介绍RC-u3 跑团机器人,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
时间限制
400 ms
内存限制
64 MB
#include <iostream>
#include <map>
using namespace std;map<int, int> ma;int main() {string s;cin >> s;s += "+";int n = int(s.size());int now = 0, last = 0;bool ok = true, dd = false;int mx = 0, mi = 0;for (int i = 0; i < n; ++ i) {if (s[i] == 'd' || s[i] == '+' || s[i] == '-') {if (s[i] == 'd') {if (now == 0) now = 1;last = now;now = 0;dd = true;} else {if (dd) {ma[now] += last;if (ok) {mx += now * last;mi += last;} else {mx -= last;mi -= now * last;}} else {if (ok) {mx += now;mi += now;} else {mx -= now;mi -= now;}}now = 0;last = 0;if (s[i] == '+') ok = true;else ok = false;dd = false;}} else {now = now * 10 + (s[i] - '0');}}for (auto x : ma) {cout << x.first << ' ' << x.second << endl;}cout << mi << ' ' << mx;
}
这篇关于RC-u3 跑团机器人的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!