알고리즘 문제풀이 오프라인 저지
Project description
개요
백준 이나 코드포스 문제를 풀 때 여러 케이스를 실행하여 결과를 보여줍니다.
설치
$ pip install problem_solving_offline_judge
문제풀이의 상단 디렉토리에 CLI 용 파일을 생성하여 다음과 같은 내용을 입력합니다.
파일명은 관계없지만 이 설명서에서는 judge.py 를 사용하겠습니다.
# judge.py
from problem_solving_offline_judge import judge
judge.cli()
사용법
$ python3 ./judge.py <문제 디렉토리 이름>
파이썬에서는 패키지로 사용할 디렉토리 이름은 문자 나 _ 로 시작해야 합니다.
하지만 디렉토리 이름을 전부 입력할 필요는 없습니다.
$ python3 ./judge.py b_1000
$ python3 ./judge.py 1000
성공할 경우 다음과 같이 출력됩니다.
$ python3 ./judge.py 1000
SUCCESS! 1.in (48 ms)
실패할 경우 다음과 같이 출력됩니다.
$ python3 ./judge.py 1000
FAIL! 1.in (47 ms)
Result:
2
Expected:
3
디렉토리 구조
├── b_1000
│ ├── 1.input.txt
│ ├── 1.output.txt
│ ├── 2.input.txt
│ ├── 2.output.txt
│ └── problem.py
├── b_1001
│ ├── ...
│ ├── ...
└── judge.sh
# problem.py
# solve, solution, main 함수 중 하나는 반드시 있어야 합니다.
def solve():
# 풀이 (아래는 백준 1000번 문제 샘플입니다)
a, b = map(int, input().split())
print(a+b)
# 백준이나 코드포스에 그대로 복사해서 붙여넣기 위해 필요합니다.
if __name__ == "__main__":
solve()
- judge.py: CLI 스크립트
- \b_1000: 문제 디렉토리
- \b_1000/1.input.txt: 입력값.
1.in과 같은 형식도 가능합니다. - \b_1000/1.output.txt: 솔루션이 출력해야하는 값. 입력값 파일명에서
in을out으로 바꾸시면 됩니다. - problem.py: 문제 모듈 파일. 이름은
problem.py이 아니어도 됩니다. 자세한 구조는 위 파일내용을 참조해주세요.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file problem_solving_offline_judge-1.0.0-py3-none-any.whl.
File metadata
- Download URL: problem_solving_offline_judge-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe74b747bd43ef3f1b0c02eddc8d33ff2bdb64e441575ce22303dc36357f9464
|
|
| MD5 |
8a93dd038378143013c5396d3779d2b9
|
|
| BLAKE2b-256 |
61a5bdbf527b7576c9907a475231c3d2009b595637ec33917ad4a68cd2e72b5b
|