Skip to content

Problem Store

Kwanghee Choi edited this page Mar 23, 2016 · 2 revisions

problems/

폴더 구조: 2-level /problemset/problem/

  • Level 1: Problem Set name
    • Level 2: Problem name

ex) problems/CT2015/w1p1/

폴더에 들어가는 내용:

  • description.md: 문제 설명

    # description.md
    화면에 "input int: "를 출력하고, 사용자에게 숫자를 하나 받아서 출력하세요.
    
  • answer.py: 나중을 위한 정답 파일

    # answer.py
    i = int(input("input int: "))
    print("int is ", i)
  • %02d.json: %02d 번째 testcase in/out

주의사항

  1. problems폴더가 git으로 관리되고있는데
    • .gitignore로 추가적인 파일을 관리하지 않도록 해놓았습니다.
    • 그래서 여기에 추후에 추가한 파일들은 손실의 우려가 있습니다.
    • git add -f를 통해 강제로 파일을 관리하게 할 수도 있으나, 정답이 외부에 공개되는 문제가 있습니다.
  2. 그러므로 실제 problems을 보관할 비공개 코드저장소(Repository)를 생성하고,
    mkdir -p ~/real_problems
    pushd ~/real_problems
    git init
  3. 실제로 사용할 문제들을 거기에 보관한 후,
    mkdir -p Lecture1/Week1_Day1/
    touch Lecture1/Week1_Day1/description.md
    git add Lecture1/Week1_Day1/description.md
    
  4. 서버가 읽는 problems 폴더에서 실제 사용할 문제를 바로가기(심볼릭링크)로 가져옵니다.
    popd
    ln -s ~/real_problems/Lecture1 .
    
  5. 서버를 재시작하면, 이제 Lecture1는 열려있습니다.

서버에서만 보이는 문제집 만들기

  1. 아까 만든 Lecture1 문제집을 가려놓고 싶다면 Lecture1 폴더에 .jrojignore 파일을 만듭니다.
    • .jrojignore 파일이 있는 폴더(문제집)의 경우 웹으로 접근이 불가능합니다.
  2. 서버를 재시작하면, 이제 다시 Lecture1은 보이지 않습니다.