// Iflytek_Exam_1.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> #include<vector> #include<string> using namespace std; vector<int> kick(vector<int> queue) { vector<int>::iterator it1; vector<int>::iterator it2; if (queue.size() == 1) return queue; for (it1 = queue.begin(), it2 = it1 + 1; it2 != queue.end(); it1++, it2++) { if (*it1 == 'R' && *it2 == 'L') { if (it1 != queue.begin()) { vector<int>::iterator it3 = it1 - 1; if (*it3 == 'R') { queue.erase(it1); break; } } if (it2 != queue.end() - 1) { vector<int>::iterator it4 = it2 + 1; if (*it4 == 'L') { queue.erase(it2); break; } } queue.erase(it2); break; } } return queue; } int check(vector<int> queue) { int len = queue.size(); while (1) { queue = kick(queue); int currlen = queue.size(); if (currlen == len) break; else len = currlen; } return queue.size(); } int main() { char q[1024] = { '