#include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main(int argc, char *argv[]) { //freopen("input.txt", "rt", stdin); //freopen("out.txt", "wt", stdout); int N; cin >> N; vector<string> names; int tempN = N; while (tempN-- > 0) { string str; cin >> str; names.push_back(str); } int W, S; char c; cin >> W >> c >> S; vector<int> assVec(N, 0); int passed = 0; int index = W - 1; //w - 1 while(passed < N) { int count = 0; while(count < S) { if(assVec.at((index++) % N) == 0) count++; } cout << names.at(((index - 1) % N)) << endl; assVec[((index - 1) % N)] = 1; passed++; } return EXIT_SUCCESS; } 简单题, 只要注意题目要求从1开始计数这一条件即可, 循环计数无非对count取模...