题目很简单,只是考的时候想的太多
#include<iostream>#include<vector>#include<string>#include<map>using namespace std;int main(){ vector<string> all; map<string, int> f; int M, N, S; cin >> M >> N >> S; all.resize(M); for (int t = 0;t < M;t++) cin >> all[t]; if (S > M) { PRintf("Keep going.../n"); return 0; }//没有的情况 int t = S-1;//开始点 while (t < M) { if (f[all[t]] != 1)//未出现过处理 { f[all[t]] = 1; cout << all[t] << endl; t += N; } else//已出现过处理 t++; }}新闻热点
疑难解答