728x90
원형연결리스트
-
[C][백준] 1158번 요세푸스 문제 : C, 원형연결리스트로 해결Algorithm/백준 2022. 9. 1. 19:35
#include #include typedef struct _node { int data; struct _node *next; struct _node *prev; }node; int N,M; node *head; node *tail; node *cur; void init() { head = (node*)malloc(sizeof(node)); tail = (node*)malloc(sizeof(node)); head->data = 'H'; tail->data = 'T'; head->next = tail; head->prev = tail; tail->next = head; tail->prev = head; cur=head; } int main() { scanf("%d%d",&N,&M); printf(""); ..