쉬운 문제다. 입력이 많아 복잡해보이지만 어렵지 않다.
vector를 사용해 시키는대로 구현하였다.
#include<iostream>
#include<vector>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
for (int t = 1; t <= 10; t++)
{
int n; cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
int e; cin >> e;
for (int i = 0; i < e; i++)
{
char mode; cin >> mode;
int x, y; cin >> x >> y;
if (mode == 'I')
{
int s[100];
for (int j = 0; j < y; j++)
cin >> s[j];
for (int j = y - 1; j >= 0; j--)
v.insert(v.begin() + x, s[j]);
}
}
printf("#%d ", t);
for (int i = 0; i < 10; i++)
printf("%d ", v[i]);
printf("\n");
}
return 0;
}
'Coding_Test 연습 > SWEA' 카테고리의 다른 글
[SWEA] (C++) D3 1230 암호문3 (0) | 2022.04.11 |
---|---|
[SWEA] (C++) D3 1229 암호문2 (0) | 2022.04.11 |
[SWEA] (C++) D3 1225 암호생성기 (0) | 2022.04.11 |
[SWEA] (C++) D3 1221 GNS (0) | 2022.04.10 |
[SWEA] (C++) D3 1220 Magnetic (0) | 2022.04.10 |