[algorithm] 백준 1021번 회전하는 큐
·
algorithm/덱
#include #include #include using namespace std;int main() { int n,m,x; cin >> n >> m; int cnt=0; vector v2; deque d; for(int tmp=1; tmp> x; v2.push_back(x); } for(int tmp : v2) { int count = 1; for(int tmp2 : d) { if(tmp2 == tmp) break; else count++; } ..
[algorithm] 백준 10866번 덱
·
algorithm/덱
스택,큐의 기본문제들과 같은 패턴으로덱을 잘 이해했는 지에 대한 개념확인 문제다#include #include #include using namespace std;int main() { ios::sync_with_stdio(0); cin.tie(0); int n,x; string s; cin >> n; deque d; for(int tmp=0; tmp> s; if(s == "push_front") { cin >> x; d.push_front(x); } if(s == "push_back") { ..