#include <math.h>
class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param students int整型vector
* @param sandwiches int整型vector
* @return int整型
*/
int countStudents(vector<int>& students, vector<int>& sandwiches) {
queue<int> q;
int n = students.size();
for (int j = 0; j < n; j++)
q.push(students[j]);
int j = 0;
while (j < n)
{
int i = n + 1 - j;
int y;
while (i)
{
y = 1;
i--;
if (sandwiches[j] == q.front())
{
q.pop();
y = 0;
break;
}
else
{
q.push(q.front());
q.pop();
}
}
if (y) break;
j++;
}
return n - j;
// write code here
}
};