int main() { #ifdef LOCAL freopen("stdin.txt", "r", stdin); // freopen("stdout.txt", "w", stdout); #endif vector<int> a = {2, 1, 3, 1}; vector<int> res = {2, 2, 1, 1}; int idx = a[0]; int cur = 2; while((int)res.size() < 20) { idx %= 4; int len = res[cur]; while(len--) { res.push_back(a[idx]); } idx++; idx %= 4; cur++; } for(auto &c : res) { cout << c << " "; } cout << endl; #ifdef LOCAL fclose(stdin); // fclose(stdout); #endif return 0; }
点赞 评论

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务