-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 修复获取环境变量出错的问题 - 增加附件 - 增加 writeup - 增加 oj 题目以及对应测试用例
- Loading branch information
Showing
39 changed files
with
451 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# [PPC] 更适合破晓宝宝的 OJ API 文档 | ||
|
||
程序只有两个 API ,URL 路径都是 `/jobs`。 | ||
|
||
GET 请求返回全部已提交的任务,返回它们的状态和结果: | ||
|
||
```json | ||
[ | ||
{ | ||
"id": 0, | ||
"created_time": "2023-10-16T18:34:16.287Z", | ||
"updated_time": "2023-10-16T18:34:16.287Z", | ||
"submission": { | ||
"source_code": "#include <stdio.h>\nint main() {\nprintf(\"Hello World!\");\nreturn 0;}", | ||
"language": "C", | ||
"problem_id": 0 | ||
}, | ||
"state": "Finished", | ||
"result": "Accepted", | ||
"cases": [ | ||
{ | ||
"result": "Compilation Success", | ||
"time": 0, | ||
"memory": 0 | ||
}, | ||
{ | ||
"result": "Accepted", | ||
"time": 0, | ||
"memory": 0 | ||
} | ||
], | ||
"flag": "flag{" | ||
}, | ||
{ | ||
"id": 1, | ||
"created_time": "2023-10-16T19:41:05.106Z", | ||
"updated_time": "2023-10-16T19:41:05.106Z", | ||
"submission": { | ||
"source_code": "#include <stdio.h>\nint main() {\nprintf(\"Hello World!\");\nreturn }", | ||
"language": "C", | ||
"problem_id": 0 | ||
}, | ||
"state": "Finished", | ||
"result": "Compilation Error", | ||
"cases": [ | ||
{ | ||
"result": "Compilation Error", | ||
"time": 0, | ||
"memory": 0 | ||
} | ||
], | ||
"flag": "" | ||
} | ||
] | ||
``` | ||
|
||
--- | ||
|
||
POST 请求提交 语言类型、题目 ID 、代码内容 ,返回此次评测结果: | ||
|
||
REQUEST: | ||
|
||
```json | ||
{ | ||
"language": "C", | ||
"problem_id": 0, | ||
"source_code": "#include <stdio.h>\nint main() {\nprintf(\"Hello World!\");\nreturn 0;}", | ||
} | ||
``` | ||
|
||
RESPONSE: | ||
|
||
```json | ||
{ | ||
"id": 3, | ||
"created_time": "2023-10-16T19:39:33.541Z", | ||
"updated_time": "2023-10-16T19:39:33.541Z", | ||
"submission": { | ||
"source_code": "#include <stdio.h>\nint main() {\nprintf(\"Hello World!\");\nreturn 0;}", | ||
"language": "C", | ||
"problem_id": 0 | ||
}, | ||
"state": "Finished", | ||
"result": "Accepted", | ||
"cases": [ | ||
{ | ||
"result": "Compilation Success", | ||
"time": 0, | ||
"memory": 0 | ||
}, | ||
{ | ||
"result": "Accepted", | ||
"time": 0, | ||
"memory": 0 | ||
} | ||
], | ||
"flag": "flag{" | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# [PPC] 更适合破晓宝宝的 OJ 题单 | ||
|
||
每个题目名前的方括号中是题目 ID,如 `[0] 输出 Hello World!`,就代表着这题的 `problem_id` 为 `0`,在提交数据时使用以下 JSON : | ||
|
||
```json | ||
{ | ||
"language": "C", | ||
"problem_id": 0, | ||
"source_code": "#include <stdio.h>\nint main() {\nprintf(\"Hello World!\");\nreturn 0;}", | ||
} | ||
``` | ||
|
||
**注意输出不要携带换行符,大小写敏感**。 | ||
|
||
## [0] 输出 Hello World! | ||
|
||
程序不接受任何输入,只输出 `Hello World!`。 | ||
|
||
**示例:** | ||
|
||
``` | ||
输入:121 | ||
输出:Hello World! | ||
``` | ||
|
||
## [1] 回文数 | ||
|
||
给你一个整数,如果它是一个回文整数,返回 `true` ;否则,返回 `false` 。 | ||
|
||
回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 | ||
|
||
- 例如,`121` 是回文,而 `123` 不是。 | ||
|
||
**示例 1:** | ||
|
||
``` | ||
输入:121 | ||
输出:true | ||
``` | ||
|
||
**示例 2:** | ||
|
||
``` | ||
输入:-121 | ||
输出:false | ||
解释:从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 | ||
``` | ||
|
||
**示例 3:** | ||
|
||
``` | ||
输入:10 | ||
输出:false | ||
解释:从右向左读, 为 01 。因此它不是一个回文数。 | ||
``` | ||
|
||
## [2] 转换成小写字母 | ||
|
||
给你一个字符串 `s` ,将该字符串中的大写字母转换成相同的小写字母,返回新的字符串。 | ||
|
||
**示例 1:** | ||
|
||
``` | ||
输入:Hello | ||
输出:hello | ||
``` | ||
|
||
**示例 2:** | ||
|
||
``` | ||
输入:here | ||
输出:here | ||
``` | ||
|
||
**示例 3:** | ||
|
||
``` | ||
输入:LOVELY | ||
输出:lovely | ||
``` | ||
|
||
## [3] 倍数求和 | ||
|
||
给你一个正整数 `n` ,请你计算在 `[1,n]` 范围内能被 `3`、`5`、`7` 整除的所有整数之和。 | ||
|
||
返回一个整数,用于表示给定范围内所有满足约束条件的数字之和。 | ||
|
||
**示例 1:** | ||
|
||
``` | ||
输入:7 | ||
输出:21 | ||
解释:在 [1, 7] 范围内能被 3、5、7 整除的所有整数分别是 3、5、6、7 。数字之和为 21 。 | ||
``` | ||
|
||
**示例 2:** | ||
|
||
``` | ||
输入:10 | ||
输出:40 | ||
解释:在 [1, 10] 范围内能被 3、5、7 整除的所有整数分别是 3、5、6、7、9、10 。数字之和为 40 。 | ||
``` | ||
|
||
**示例 3:** | ||
|
||
``` | ||
输入:9 | ||
输出:30 | ||
解释:在 [1, 9] 范围内能被 3、5、7 整除的所有整数分别是 3、5、6、7、9 。数字之和为 30 。 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# [PPC] 更适合破晓宝宝的 OJ 使用指南 | ||
|
||
OJ 即 OnlineJudge,在线评测系统,用于自动评判编程代码的准确性和效率。 | ||
|
||
**你的程序要求实现接收特定的内容,并输出对应的正确内容**。 | ||
|
||
**你提交的代码,会在系统中编译后,根据提交的对应题目进行测试**。 | ||
|
||
**每道题都有一个或多个测试用例,用于判断你给出的程序的正确性**。 | ||
|
||
测试用例是的一组文件,分别对应着**程序输入**和**程序该有的输出**。当测试失败时,返回结果中可以看到是哪个测试用例因为什么失败,如答案错误。(不会有测试用例的具体内容) | ||
|
||
允许且推荐使用 ChatGPT 以及搜索引擎等工具,因为平台根本没法不允许,也没必要。 | ||
|
||
当然自己写的代码是最酷的。 | ||
|
||
不过,想想这题还能怎么做?这可是 CTF。 | ||
|
||
## FLAG 从哪来 ? | ||
|
||
每完成一道题目,会从服务器根目录的 `/flag`文件中返回一部分 FLAG。 | ||
|
||
每道题的 FLAG 片段都是固定的。 | ||
|
||
做题顺序不限制,但 FLAG 片段是有序的。 | ||
|
||
比如第一题,返回的就是 FLAG 第一个片段,第二题就是第二个片段,共四题,组合起来就是完整 FLAG 。 | ||
|
||
## 怎么做题 ? | ||
|
||
系统没有前端页面,只有一个 Web API ,你可以参照 [API 文档](API.md) 中的规范,使用任何可以发送 HTTP 包的工具来调用。 | ||
|
||
但由于在 JSON 中手写代码会遇到字符转义的痛苦事情,建议自写脚本或使用题目附件中提供的 `judge.py` 。 | ||
|
||
你需要修改 `judge.py` 中 `localhost` 为你的容器 IP。 | ||
|
||
修改 `judge.py` 中 `12345` 为你的容器端口。 | ||
|
||
并根据题目 ID 修改 `judge.py` 中 `problem_id` 为对应题目 ID。 | ||
|
||
修改 `test.c` 内容为你要提交的代码。 | ||
|
||
然后运行 `python judge.py`。 | ||
|
||
`judge.py` 会返回提交过所有任务的结果,而不是只有本次结果,以 JSON 格式显示。 | ||
|
||
## 语言 | ||
|
||
语言有两者可选 `C`、`CPP`,需要在 `judge.py` 修改 `language` 为 `"C"` 或 `"CPP"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
121 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-121 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1234554321 |
Oops, something went wrong.