inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

OrderControllerV1 인터페이스에 @RequestMapping 선언 시 404 not found 뜨시는 분들

미해결

스프링 핵심 원리 - 고급편

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 [질문 내용] 저와 같은 문제를 겪을까 포스팅 합니다. 스프링 부트 3.2 버전 사용 중이며, @RequestMapping 어노테이션 사용 시에 404 not found가 반환될텐데, 해당 부분 @RestController로 변경 시 정상적으로 ok 반환됩니다.

  • spring
  • 디자인-패턴
ym.park 댓글 2 좋아요 1 조회수 668

인피니트 스크롤링 적용시 LOAD_POST_REQUEST 두번 찍히는 문제

미해결

[리뉴얼] React로 NodeBird SNS 만들기

안녕하세요 선생님 상황) 인피니트 스크롤링 적용시 LOAD_POST_REQUEST 두번 찍히는 상황인데 이거의 원인과 해결방법을 어떻게 찾을 수 있을까요? loadPostsLoading과 throttle을 적용했는데도 2번씩 실행되는 상황입니다. redux) 작성한 코드) 10,000 자이하만 적을 수 있어서 LOAD_POSTS_REQUEST 관련 코드만 올립니다..!! pages/index.js import React, { useEffect } from 'react'; import {useDispatch, useSelector} from 'react-redux'; import AppLayout from '../components/AppLayout'; import PostCard from '../components/PostCard'; import PostForm from '../components/PostForm'; import {LOAD_POSTS_REQUEST} from '../reducers/post'; const Home = () => { const dispatch = useDispatch(); const { me } = useSelector((state) => state.user); const { mainPosts, hasMorePosts, loadPostsLoading } = useSelector((state) => state.post); useEffect(() => { dispatch({ type: LOAD_POSTS_REQUEST, }); }, []); useEffect(() => { function onScroll() { if(window.scrollY + document.documentElement.clientHeight > document.documentElement.scrollHeight-300) { if(hasMorePosts && !loadPostsLoading) { dispatch({ type: LOAD_POSTS_REQUEST, }); } } } window.addEventListener('scroll', onScroll); return () => { window.removeEventListener('scroll', onScroll); }; }, [hasMorePosts, loadPostsLoading]); return ( <AppLayout> {me && <PostForm />} {mainPosts.map((post) => <PostCard key={post.id} post={post} />)} </AppLayout> ); }; export default Home; reducers/post.js import shortId from 'shortid'; import {produce} from 'immer'; import faker from 'faker'; export const initialState = { mainPosts:[], imagePaths: [], //게시물 저장 경로 hasMorePosts: true, loadPostsLoading: false, //게시글 로드 완료시 true loadPostsDone: false, loadPostsError: null, } export const generateDummyPost = (number) => Array(number).fill().map(() => ({ id: shortId.generate(), User: { id: shortId.generate(), nickname: faker.name.findName() }, content: faker.lorem.paragraph(), Images: [{ src: 'https://cdn.pixabay.com/photo/2017/07/25/01/22/cat-2536662_1280.jpg' //faker.image.imageUrl(640, 480, true), lorempixel.com 고장나서 임시로 }], Comments: [{ User: { id:shortId.generate(), nickname:faker.name.findName(), }, content:faker.lorem.sentence(), }], })); export const LOAD_POSTS_REQUEST = 'LOAD_POSTS_REQUEST'; export const LOAD_POSTS_SUCCESS = 'LOAD_POSTS_SUCCESS'; export const LOAD_POSTS_FAILURE = 'LOAD_POSTS_FAILURE'; const dummyPost = (data) => ({ id: data.id, content: data.content, User: { id:1, nickname:'해지니', }, Images: [], Comments: [], }); const dummyComment = (data) => ({ id: shortId.generate(), content: data, User: { id: 1, nickname: '제로초' }, }); const reducer = (state = initialState, action) => produce(state, (draft) => { switch(action.type){ case LOAD_POSTS_REQUEST: draft.loadPostsLoading = true; draft.loadPostsDone = false; draft.loadPostsError = null; break; case LOAD_POSTS_SUCCESS: draft.loadPostsLoading = false; draft.loadPostsDone = true; draft.mainPosts = action.data.concat(draft.mainPosts); draft.hasMorePosts = draft.mainPosts.length < 50; break; case LOAD_POSTS_FAILURE: draft.loadPostsLoading = false; draft.loadPostsError = action.error; break; default: break; } }); export default reducer; sagas/post.js import { all, fork, takeLatest, put, delay, throttle } from 'redux-saga/effects'; import axios from 'axios'; import shortId from 'shortid'; import { LOAD_POSTS_REQUEST, LOAD_POSTS_SUCCESS, LOAD_POSTS_FAILURE, generateDummyPost, } from '../reducers/post'; function loadPostsAPI(data){ return axios.get('/api/post', data); } function* loadPosts(action) { try{ // const result = yield call(loadPostsAPI, action.data); yield delay(1000); yield put({ type: LOAD_POSTS_SUCCESS, data:generateDummyPost(10) }); } catch(err) { yield put({ type: LOAD_POSTS_FAILURE, data: err.response.data }); } } function* watchLoadPosts(){ yield throttle(5000, LOAD_POSTS_REQUEST, loadPosts); } export default function* postSaga() { yield all([ fork(watchLoadPosts) ]); } 사용중인 OS) macOS (Apple M1 Pro)

  • react
  • redux
  • node.js
  • express
  • next.js
박해진 댓글 2 좋아요 0 조회수 372

윈도우 gradlew.bat build 에러 발생

미해결

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

C:\Users\Yoon>cd C:\Users\Yoon\Desktop\CS\SpringStudy\hello-spring C:\Users\Yoon\Desktop\CS\SpringStudy\hello-spring>gradlew.bat build FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'hello-spring'. > Could not resolve all files for configuration ':classpath'. > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.1. Required by: project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1 > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.1 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 5s "빌드하고 실행하기" 강의에서 위 에러가 발생하였습니다. 우선 저는 윈도우 사용자입니다. java --version으로 확인해봐도 Java 17버전이고, 설정 가능한 모든 부분에서 17버전으로 바꿨는데도 에러가 발생합니다. 파일 링크 : https://drive.google.com/file/d/1hnY1DJJ-9loR_mcQBum97NDgOErGgoMO/view?usp=drive_link

  • java
  • spring
  • mvc
  • spring-boot
댓글 2 좋아요 0 조회수 810

첫화면 버튼이 css 적용이 안됩니다..

미해결

<M.B.I.T> 테스트 페이지 만들기! with Django

.buttons button { width: 300px; height: 50px; padding: 5px; border-style: none; border-radius: 10px; font-family: "NEXON Lv1 Gothic OTF"; font-size: 20px; font-weight: bold; cursor: pointer; background-color: #fff; color: #7F47DD; margin-bottom: 20px; } 로 코드 올려주신 것 그대로 했는데도 아래 사진처럼 기본 버튼으로 됩니다..다른 css 디자인은 잘 적용이 됩니다.뭐가 문제일까요?

  • HTML/CSS
  • javascript
  • django
긴장한 낙지 댓글 1 좋아요 0 조회수 526

질문있습니다.

미해결

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

basket screen에서 appBar에 뒤로가기 기능을 입혀보려고 합니다. 다른 페이지들은 가능한데, 장바구니 페이지에서는 뒤로가기 기능이 안되더라고요, paginationListview로 씌우고 <BasketITemModel>를 넣으려고 해서 안되는 것 같은데요, 이게 가능하도록 하려면 어떻게 해야할까요?

  • flutter
  • 하이브리드-앱
김지현 댓글 1 좋아요 0 조회수 273

build and run 과 apk파일 설치 방법 질문

해결됨

두고두고 써먹는 유니티 VR

안녕하세요 먼저 좋은 강의 감사드립니다. 저는 유니티버전 2021.2.13f로 수강중이며 XR Toolkit 버전도 2.0.0으로 내려서 수강중입니다. 오큘러스 2 기기를 가지고 있으며, 유선케이블로 PC와 연결하여 쓰고 있습니다. (하프라이프도 그걸로 즐기고있습니다) 몇가지 문제가 있어서 질문드립니다. 첫째는 유니티 에디터에서 Android로 스위치한뒤, build and run 을 하려고해도 run device 에 oculus2 기기가 뜨질 않습니다. 분명 기기랑 연결이 된 상태인데 뜨지 않아서, ADB 2.0 을 깔면 된다길래 그것도 시도해봤지만 뜨질 않습니다. 둘째는, build and run 이 되지 않아서 apk파일을 빌드한뒤, sideQuest등으로 넣어보려고 했는데, 그러려면 메타 개발자 페이지에서 개발자 인증을 받아야 한다고 들었습니다. (현재는 조직만 생성해두고 아직 인증 신청해둔 상태입니다.) 그런데 모바일앱 상에서도 '기기 -> 개발자 모드 활성화' 가 보이지 않습니다. 메타 개발자페이지에서 조직생성 후 인증까지 받아야만 -> 모바일앱에서 개발자 모드를 활성화 할수 있는것인지 궁금합니다. 그리고 모바일앱에서 개발자 모드를 활성화해야만 sideQuest를 통해 apk파일을 설치할 수 있는것인지 궁금합니다. 질문이 길어 송구합니다.

  • unity
  • VR/AR
  • 유니티-vr
구본기 댓글 1 좋아요 2 조회수 917

질문있습니다

미해결

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 [질문 내용] 안녕하세요 오늘도 어김없이 강의구매후 잘보고있습니다 ㅎ다름이 아니라 강의를 아직 보고있는데 궁금한게 생겨서요ㅎㅎ 스프링부트 내장 톰캣 을 사용하고 정적 , 동적 파일이 있잖아요 중 정적파일 처리 과정이 궁금해서Ex) 스프링부트에 내장 톰캣에 타임리프 사용시 localhost/index.html 을 호출하면 html의 경우 정적파일인데 jsp처럼 html 정적파일도 뮤조건 톰캣 서블릿을 타서 스프링에서 뷰리졸브(view)를 통해 응답을 해주는걸까요 아니면 톰캣에서 정적파일이내 를 분류해서 바로 뿌려주게되나요 ?? 이게궁금해서요

  • spring
  • mvc
넌멋지다 댓글 2 좋아요 0 조회수 268

$route 등 자동완성이 안됩니다. ㅠㅠ

미해결

Vue 3 & Firebase 10 커뮤니티 만들기 풀스택 - "활용편" (with Pinia, Quasar, Tiptap, VueUse)

죄송합니다. $route 는 자동완성이 안되는게 정상인거네요. 제가 되는걸로 착각해서 질문을 했는데.. 짐코딩님 포기 않고 답변해주시고 도와 주신 점 정말 감사합니다. [ 질문원문 ] 안녕하세요. 개발환경 volra 와 Snippets 모두 설치 했는데. 자동완성이 안되는 게 있습니다. [Auto Page 설정 : unplugin-vue-router]과정 수강중인데요. $route 등이 안나오는데.. 왜 그러는지 조언을 구할 수 있을까요?

  • vue.js
  • firebase
  • quasar
  • algolia
  • vue-3
공부할소 댓글 3 좋아요 0 조회수 565

하위 테이블이 되는 엔티티에서 외래키 컬럼을 별도로 작성하는 이유가 궁금합니다

해결됨

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

강의에서 OneToMany, ManyToOne 관계인 엔티티들을 보면 /entity/Users.ts // ... @Entity({ schema: 'sleact', name: 'users' }) export class Users { @PrimaryGeneratedColumn({ type: 'int', name: 'id' }) id: number; // ... @OneToMany( () => WorkspaceMembers, (workspacemembers) => workspacemembers.User, ) WorkspaceMembers: WorkspaceMembers[]; // ... } /entity/WorkspaceMembers.ts @Entity('workspacemembers', { schema: 'sleact' }) export class WorkspaceMembers { // ... @Column('int', { primary: true, name: 'UserId' }) UserId: number; // ... @ManyToOne(() => Users, (users) => users.WorkspaceMembers, { onDelete: 'CASCADE', onUpdate: 'CASCADE', }) @JoinColumn([{ name: 'UserId', referencedColumnName: 'id' }]) User: Users; // ... } WorkspaceMembers 엔티티에서 UserId 컬럼을 별도로 작성하신 뒤 @JoinColumn 데코레이터에서 Users 엔티티에서 가져온 'id'컬럼을 본 엔티티에서 'UserId' 컬럼으로 사용하겠다고 지정하셨는데요 이외에도 다른 일대다, 다대일 관계인 엔티티 중 다대일 파일들에 모두 '(상위테이블)Id' 이런 식으로 컬럼을 직접 설정하셨더라구요. 이 이유가 무엇인지에 대해서 질문드리고 싶어서 글 작성합니다. 개인적으로 연습하면서 TypeORM 공식문서나 깃북을 확인했을때는 관계에 대해서는 지정을 하되, 하위 테이블에선 별도로 외래키에 대한 컬럼까지는 작성하지 않았는데요. 제가 작업중인 환경에서 테스트할 때도 user.entity.ts // ... @Entity({ name: 'Users' }) export class Users { @PrimaryGeneratedColumn({ type: 'int', name: 'id' }) id: number; // .. @OneToMany(() => Posts, (post: Posts) => post.user, { cascade: true, }) post: Posts[]; } posts.entity.ts // ... @Entity({ name: 'Posts' }) export class Posts { @PrimaryGeneratedColumn({ type: 'int', name: 'id' }) id: number; // @Column({ type: 'int' }) // userId: number; // ... @ManyToOne(() => Users, (user: Users) => user.post, { onDelete: 'CASCADE', }) // 외래키 정보 // @JoinColumn([ // { // referencedColumnName: 'id', // 상대방 컬럼 // name: 'userId', // 여기서 쓸 컬럼 // }, // ]) user: Users[]; } 이 상태에서 DB와 테이블을 생성했을때 외래키가 되는 'userId'가 생성되는 것 확인하였습니다. 단 이 상태에서는 서비스 단에서 리포지터리로 데이터를 입력할 수가 없었습니다. 이 부분은 JoinColumn 데코레이터가 있어도 결과는 같았습니다. 혹시 자동적으로 만들어지는 외래키 컬럼에는 서비스에서 typeorm 사용해도 직접적으로 데이터를 집어 넣지 못하기 때문에, 외래키 컬럼을 직접 만들어주고 JoinColumn 데코레이터 사용해서 명시적으로 지정을 해줘야만 한다 라고 생각하면 될까요? 제가 제대로 이해한 것이 맞을까요?

  • node.js
  • express
  • nestjs
  • typeorm
jeongho218 댓글 1 좋아요 0 조회수 373

fetch 사용이유

해결됨

Next + React Query로 SNS 서비스 만들기

안녕하세요 강의중에는 fetch를 사용하는데 기존에 프로젝트를 진행할때, baseUrl 설정이나 기본 헤더 설정, 인터셉터 및 json 직렬화 등 의 불편함으로 axios를 사용하였었는데 next에서 캐싱관련해서 fetch를 확장해서 제공해주기때문에 axios를 사용하지않고 fetch로 사용하는걸까요?

  • react
  • next.js
  • react-query
  • next-auth
  • msw
밍끼 댓글 2 좋아요 0 조회수 919

State 문제

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

useState(0) 에서 결과값을 볼려고 했는데 0이 안떠서 값을 못보겠습니다. 코드에 문제가 있는걸까요?

  • javascript
  • node.js
오동윤 댓글 2 좋아요 0 조회수 162

중괄호 부분이 이해가 안갑니다.

미해결

[코드팩토리] [초급] 8시간만에 끝내는 코드팩토리의 Typescript 완전정복 풀코스

function instantiator<T extends { new(...args: any[]): {} } > extends 다음에 { new ... } 이렇게 표시된 부분에서 중괄호가 의미하는 게 객체를 의미하는 건가요? any[]): {} 여기에서 사용된 중괄호는 object를 의미하는 건가요? 그렇다면 Object로 작성해도 괜찮나요?

  • typescript
kimgni.dev 댓글 1 좋아요 0 조회수 285

노션 자료 어떻게 활용하나요?

해결됨

Flutter 앱 개발 실전

노션은 처음이라 몇가지 구글링 해봤는데, 제가 개인적으로 가져와 오프라인으로 볼 수는 없나 봐요? 그냥, 링크로 웹으로 들어가서 봐야 하는게 다인가요?

DK L 댓글 1 좋아요 1 조회수 252

h2db에 입력후 localhost 조회시 안나옴

미해결

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

https://drive.google.com/file/d/1bWQeZq1FfiqL2cIEU7zJu-_Td0NSqGwF/view?usp=drive_link

  • java
  • spring
  • mvc
  • spring-boot
ja04261 댓글 2 좋아요 0 조회수 295

안녕하세요 로그엔 성공적으로 들어온것같습니다..

미해결

스프링부트 JUnit 테스트 - 시큐리티를 활용한 Bank 애플리케이션

안녕하세요 그전에 질문 올렸던 수강생입니다.. 이번에 로그엔 성공적으로 postman로 올린경우 된 것같은데 아래에는 error라고 뜨네여,, https://github.com/kimjeonggeon/bankapplication.git branch 2-bankApplication 입니다.

  • spring-boot
  • junit
  • 소프트웨어-테스트
kjkkmk42397 댓글 1 좋아요 0 조회수 266

깃허브 블로그 비공개(Private) 방법 문의

해결됨

깃헙 블로그(Github blog)로 차별화 된 나만의 홈페이지 만들기!

안녕하세요. 깃허브 블로그나 몇몇 올린 게시글들을 비공개 처리 하려고 하는데 "For security reasons, you cannot change the visibility of a fork." 계속 이런 문구가 떠서 비공개 처리가 안됩니다. 방법이 없을까요?

  • 블로그
  • github
zxd753 댓글 1 좋아요 0 조회수 2096

강의 자료나 소스코드가 다운이 안받아져요..

미해결

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 아니오 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 아니요 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 아니오.. [질문 내용] 여기에 질문 내용을 남겨주세요. 강의자료가 자꾸 오류로 다운이 안되는데 왜그런걸까요..? ㅠㅠ

wlgus1598 댓글 2 좋아요 0 조회수 307

프롬프트 명령어 - 입력값과 동일한 언어로 받으려면 어떻게 작성할까요?

해결됨

React + GPT API로 AI회고록 서비스 개발 (원데이 클래스)

좋은 내용 감사합니다. 프롬프트 내용중에 "Translate Into Korean~" 이라는 내용으로 답변을 한글로 받게 됩니다. 혹시 [events] 밑에 오는 사용자 입력값과 동일한 언어로 결과를 받고 싶다면 어떻게 작성하면 될까요? 강의 내용을 기준으로 다국어 서비스를 만들려고 하는데, 영어가 짧아서 질문 드려요

  • HTML/CSS
  • javascript
  • react
  • node.js
  • chatgpt
도옥현 댓글 2 좋아요 1 조회수 480

result code build 시에 오류 있으신 분들

미해결

초보를 위한 도커 안내서

https://www.sysnet.pe.kr/2/0/13331 해당 사이트 들어가서 오류 지점 전에 Dockerfile 명령어 추가하시면 됩니다 RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list

  • docker
ij16_21 댓글 2 좋아요 4 조회수 388

BFS 당근마켓 승원이 문제 질문이 있습니다!

해결됨

10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트

안녕하세요! 큰돌님. 문제를 풀다가 자꾸 visited 배열에 오버플로우가 일어나는 것 같아서 예시 코드와 비교해 봤더니, 큰돌님은 max_n = 104로 배열의 크기를 최대로 정의 해 놓으셨더라구요. 그래서 큰돌님 처럼 다음과 같이 배열의 크기를 최대로 해놓고 하니, 문제가 해결되었습니다. const int max_n = 104; 저는 입력받는 코드를 따로 만들지 않아서, 크기를 예측할 수 있는 코드여서 5X5 로 정의를 해놓았는데, 왜 오버플로우가 일어나는 지 궁금합니다! 제가 작성했던 코드 첨부하겠습니다. // Online C++ compiler to run C++ program online #include <bits/stdc++.h> using namespace std; const int max_n = 104; int dy[4] = {-1, 0, 1, 0}; int dx[4] = {0, 1, 0, -1}; int main() { int N = 5; int M = 5; int x,y; int visited[N][M] = {0,}; //방문 노드 //시작 지점 int sx = 0, sy = 0; //끝 지점 int ex = 0, ey = 4; //MAP int map[N][M] = { {1,0,1,0,1}, {1,1,1,0,1}, {0,0,1,1,1}, {0,0,1,1,1}, {0,0,1,1,1} }; queue<pair<int, int>> q; //깊이 탐색을 위한 큐 visited[sy][sx] = 1; // start 위치 방문 처리 q.push({sy,sx}); while(q.size()) { tie(y,x) = q.front(); q.pop(); for(int i = 0; i < 4 ; i++) { int ny = y + dy[i]; int nx = x + dx[i]; if(ny < 0 || ny >= N || nx < 0 || nx >= M || map[ny][nx] == 0) continue; if(visited[ny][nx]) continue; visited[ny][nx] = visited[y][x] + 1; q.push({ny, nx}); } } printf("%d\n", visited[ey][ex]); // 최단거리 디버깅 for(int i = 0; i < N; i++){ for(int j = 0; j < M; j++){ cout << visited[i][j] << ' '; } cout << '\n'; } return 0; }

  • c++
  • 코딩-테스트
  • bfs
kamin_s2 댓글 1 좋아요 0 조회수 304

인기 태그

인프런 TOP Writers

주간 인기글