Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions caucsejunseo/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
## โœ๏ธ ๊ธฐ๋ก

| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
|:----:|:---------:|:----:|:-----:|:----:|
| 1์ฐจ์‹œ | 2025.03.18 | ๊ทธ๋ฆฌ๋”” | [๋™์ „0](https://www.acmicpc.net/problem/11047)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/4|
| 2์ฐจ์‹œ | 2025.03.22 | ์Šคํƒ | [๋‹จ์–ด๋’ค์ง‘๊ธฐ2](https://www.acmicpc.net/problem/17413)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/8|
| 3์ฐจ์‹œ | 2025.03.26 | ์Šคํƒ | [์ข‹์€๋‹จ์–ด](https://www.acmicpc.net/problem/3986)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/12|
| 4์ฐจ์‹œ | 2025.03.27 | ์Šคํƒ | [๊ณผ์ œ๋Š”๋๋‚˜์ง€์•Š์•„!](https://www.acmicpc.net/problem/17952)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/14|
| 5์ฐจ์‹œ | 2025.04.02 | ํ | [์š”์„ธํ‘ธ์Šค๋ฌธ์ œ](https://www.acmicpc.net/problem/1158)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/19|
---
| 1์ฐจ์‹œ | 2025.03.18 | ๊ทธ๋ฆฌ๋”” | [๋™์ „0](https://www.acmicpc.net/problem/11047)|[#4}]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/4|
| 2์ฐจ์‹œ | 2025.03.22 | ์Šคํƒ | [๋‹จ์–ด๋’ค์ง‘๊ธฐ2](https://www.acmicpc.net/problem/17413)|[#8]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/8|
| 3์ฐจ์‹œ | 2025.03.26 | ์Šคํƒ | [์ข‹์€๋‹จ์–ด](https://www.acmicpc.net/problem/3986)|[#12]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/12|
| 4์ฐจ์‹œ | 2025.03.27 | ์Šคํƒ | [๊ณผ์ œ๋Š”๋๋‚˜์ง€์•Š์•„!](https://www.acmicpc.net/problem/17952)|[#14]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/14|
| 5์ฐจ์‹œ | 2025.04.02 | ํ | [์š”์„ธํ‘ธ์Šค๋ฌธ์ œ](https://www.acmicpc.net/problem/1158)|[#19]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/19|
| 6์ฐจ์‹œ | 2025.04.06 | ํ | [์•ต๋ฌด์ƒˆ](https://www.acmicpc.net/problem/14713)|[#23]https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/23|
112 changes: 112 additions & 0 deletions caucsejunseo/ํ/2025.04.06.์•ต๋ฌด์ƒˆ.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX_parrot 100
#define MAX_words 100
#define WORDLINE 33

char sentence[350000];
char line[350000];

typedef struct
{
char words[MAX_words][WORDLINE];
int front, rear;
}Queue;

void initqueue(Queue* q) //Queue* q๋Š” Queue ๊ตฌ์กฐ์ฒด์˜ ์ฃผ์†Œ๋ฅผ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฐ›๊ฒ ๋‹ค๋Š” ๋œป
{
q->front = q->rear = 0; // q.front = 0; ์ง์ ‘ ๊ตฌ์กฐ์ฒด์ผ ๋•Œ๋Š” .
} //qr->front = 0; ํฌ์ธํ„ฐ์ผ ๋• -> . (*q).front์˜ ์ค„์ž„ํ‘œํ˜„

void enqueue(Queue* q, char* word)
{
strcpy(q->words[q->rear++], word);
}

int dequeue(Queue* q, char* buffer)
{
if (q->front < q->rear) {
strcpy(buffer, q->words[q->front++]);
return 1;
}
return 0;
}

int isEmpty(Queue* q) {
return q->front == q->rear;
}
Queue parrot[MAX_parrot];
int main()

{
int N;
scanf("%d\n", &N); //fgets ์“ธ๋•Œ \n์ฒ˜๋ฆฌ



int i = 0;
for (i = 0; i < N; i++)
{
initqueue(&parrot[i]);



fgets(line, sizeof(line), stdin);

char* token = strtok(line, " \n");//**"๋‹จ์–ด ์ „์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ํฌ์ธํ„ฐ"**๋‹ˆ๊นŒ โ†’ char* token

while (token)
{
enqueue(&parrot[i], token);
token = strtok(NULL, " \n");
}

}

fgets(sentence, sizeof(sentence), stdin);

char* token = strtok(sentence, " \n");
int success = 1;

while (token)
{
int found = 0;
for (i = 0; i < N; i++)
{
if (!isEmpty(&parrot[i]) && strcmp(parrot[i].words[parrot[i].front], token) == 0)
{
parrot[i].front++;
found = 1;
break;
}
}
if (!found)
{
success = 0;
break;
}

token = strtok(NULL, " \n");


}
if (success) {
for (int i = 0; i < N; ++i) {
if (!isEmpty(&parrot[i])) {
success = 0;
break;
}
}
}

if (success == 1)
printf("Possible");
else if (success == 0)
printf("Impossible");


return 0;
}