怎么做啊啊啊啊啊啊
2026-01-03 09:47:21
发布于:北京
7阅读
0回复
0点赞
没过!!!!!
啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int m;
cin >> m;
vector<string> history;
int currentIndex = -1;
bool canForward = false;
for (int i = 0; i < m; ++i) {
char op;
cin >> op;
if (op == 'v') {
string url;
cin >> url;
history.resize(currentIndex + 1);
history.push_back(url);
currentIndex++;
canForward = false;
cout << url << endl;
} else if (op == 'b') {
if (currentIndex > 0) {
currentIndex--;
canForward = true;
cout << history[currentIndex] << endl;
} else {
cout << "?" << endl;
}
} else if (op == 'f') {
if (canForward && currentIndex + 1 < history.size()) {
currentIndex++;
canForward = false;
cout << history[currentIndex] << endl;
} else {
cout << "?" << endl;
}
}
}
return 0;
}
这里空空如也




有帮助,赞一个