회원가입
로그인
Toggle navigation
문제
문제
전체 문제
문제 출처
단계별로 풀어보기
알고리즘 분류
추가된 문제
문제 순위
문제
푼 사람이 한 명인 문제
아무도 못 푼 문제
최근 제출된 문제
최근 풀린 문제
랜덤
출처
ICPC
Olympiad
한국정보올림피아드
한국정보올림피아드시․도지역본선
전국 대학생 프로그래밍 대회 동아리 연합
대학교 대회
카카오 코드 페스티벌
Coder's High
ICPC
Regionals
World Finals
Korea Regional
Africa and the Middle East Regionals
Europe Regionals
Latin America Regionals
North America Regionals
South Pacific Regionals
문제집
대회
1
채점 현황
랭킹
게시판
그룹
더 보기
재채점 기록
블로그
강의
실험실
도움말
BOJ Stack
BOJ Book
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
링크드 리스트 런타임 에러...
5397번 - 키로거
kingkk31
7년 전
0
이중 링크드 리스트를 구현해서 풀었는데 테스트 케이스는 잘되는데 런타임 에러가 뜹니다...
어디서 문제인걸까요??
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <queue> #include <vector> #include <stack> #include <set> #include <map> #include <list> #include <string> #include <string.h> #include <math.h> #include <algorithm> #include <malloc.h> #include <functional> #include <time.h> #include <cctype> #pragma warning(disable:4996) using namespace std; typedef struct linked { char c; linked *front; linked *next; }linked, *plinked; int main(void) { int n; scanf("%d", &n); while (n--) { plinked cur = NULL; string str; cin >> str; for (int i = 0; i < str.length(); i++) { char c = str[i]; if (c == '<') { if (cur != NULL && cur->front != NULL) cur = cur->front; } else if (c == '>') { if (cur != NULL && cur->next != NULL) cur = cur->next; } else if (c == '-') { plinked temp = cur; if (cur->front != NULL) { if (cur->next != NULL) cur->front->next = cur->next; else cur->front->next = NULL; cur = cur->front; } else { if (cur->next != NULL) cur = cur->next; else cur = NULL; } delete(temp); } else { plinked node = new linked; node->c = c; node->front = NULL; node->next = NULL; if (cur == NULL) cur = node; else if(cur->next != NULL) { node->next = cur->next; cur->next->front = node; cur->next = node; node->front = cur; cur = node; } else { cur->next = node; node->front = cur; cur = node; } } } if(cur != NULL) while (cur->front != NULL) cur = cur->front; while (cur != NULL) { printf("%c", cur->c); cur = cur->next; } printf("\n"); } return 0; }
댓글을 작성하려면
로그인
해야 합니다.
kingkk31 7년 전
이중 링크드 리스트를 구현해서 풀었는데 테스트 케이스는 잘되는데 런타임 에러가 뜹니다...
어디서 문제인걸까요??