Skip to content

Commit 5d67668

Browse files
committed
2024-05-08 queuestack
1 parent 41430fe commit 5d67668

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

โ€Žoesnuj/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
| 4์ฐจ์‹œ | 2024.04.06 | ์Šคํƒ | [์˜ฅ์ƒ ์ •์› ๊พธ๋ฏธ๊ธฐ](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) |
99
| 5์ฐจ์‹œ | 2024.04.13 | ์ด๋ถ„ํƒ์ƒ‰ | [๋“ฃ๋ณด์žก](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) |
1010
| 6์ฐจ์‹œ | 2024.05.06 | ๊ธฐํ•˜ํ•™ | [์ •์‚ฌ๊ฐํ˜•](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) |
11+
| 7์ฐจ์‹œ | 2024.05.08 | ์Šคํƒ, ํ, ๋ฑ | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) |
1112
---

โ€Žoesnuj/๋ฑ/24511.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <iostream>
2+
#include <deque>
3+
#include <vector>
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ios::sync_with_stdio(false); cin.tie(NULL);
9+
int n;
10+
cin >> n;
11+
vector <int> dataStructure(n); //์Šคํ…์ธ์ง€ ํ์ธ์ง€ ์ž…๋ ฅ๋ฐ›๊ธฐ
12+
for (auto& i : dataStructure){
13+
cin >> i;
14+
}
15+
16+
deque <int> queuestack;
17+
for (int i = 0; i < n; i++)
18+
{
19+
int x;
20+
cin >> x;
21+
if (dataStructure.at(i) == 0) //ํ์ธ ๊ฒฝ์šฐ์—๋งŒ ์ฒ˜๋ฆฌ, ์Šคํƒ์€ ๋ฌด์กฐ๊ฑด ์ž…๋ ฅ๊ฐ’์ด ๋‚˜์˜ค๊ธฐ์— ์—†๋‹ค๊ณ  ๋ณด๋ฉด๋จ
22+
queuestack.push_back(x);
23+
}
24+
int m;
25+
cin >> m;
26+
for (int i = 0; i < m; i++)
27+
{
28+
int x;
29+
cin >> x;
30+
queuestack.push_front(x);
31+
cout << queuestack.back() << " ";
32+
queuestack.pop_back();
33+
}
34+
return 0;
35+
}

0 commit comments

Comments
ย (0)