openclaw 网盘下载
OpenClaw

技能详情(站内镜像,无评论)

首页 > 技能库 > NCCU OJ

Solve competitive programming problems on NCCUOJ (https://nccuoj.ebg.tw). Use when: solving OJ problems, reading problem statements, writing solutions in C/C...

开发与 DevOps

许可证:MIT-0

MIT-0 ·免费使用、修改和重新分发。无需归因。

版本:v1.0.2

统计:⭐ 0 · 141 · 0 current installs · 0 all-time installs

0

安装量(当前) 0

🛡 VirusTotal :良性 · OpenClaw :良性

Package:andyjjrt/nccuoj

安全扫描(ClawHub)

  • VirusTotal :良性
  • OpenClaw :良性

OpenClaw 评估

The skill's code and instructions match its stated purpose (fetch problems, write solutions, submit and check results on NCCUOJ); it requires user credentials only when needed and stores session cookies locally, with no unrelated permissions or external installs.

目的

Name/description match the included Python scripts (get_problem, submit, check_result, session). All network calls target the NCCUOJ API and the stored files (.nccuoj/* and solution files) align with the described functionality.

说明范围

SKILL.md instructs the agent to request usernames/passwords when needed and to run the included scripts. The scripts read/write only the .nccuoj workspace directory and call the NCCUOJ API. Note: the workflow instructs passing passwords as CLI arguments (exposed to the process list) and the scripts persist cookies to .nccuoj/cookies.txt; these are privacy/security considerations but are expected for a CLI-based OJ helper.

安装机制

There is no install step or remote download. This is an instruction+script bundle using only Python stdlib. No external package installs or unknown URLs are used.

证书

The skill declares no required env vars. The code supports an override NCCUOJ_BASE_URL environment variable (useful for testing); this is reasonable but means a user or environment could redirect requests to a different server if set. Credentials are supplied at runtime (CLI args) rather than via a declared primary credential — this matches the described behavior but has the usual CLI-password exposure risk. The scripts persist session cookies…

持久

always:false and the skill does not request system-wide changes or modify other skills. It creates/uses only its own .nccuoj directory for cookies and solution files (normal and scoped).

综合结论

This skill appears to be what it claims — it fetches problems and can submit/check solutions for NCCUOJ. Before installing or running it, consider: - Password exposure: the examples use CLI arguments for username/password, which can be visible to other users/processes on the same machine; prefer typing credentials interactively or using a guarded mechanism if available. - Cookie storage: session cookies are saved to .nccuoj/cookies.txt in the …

安装(复制给龙虾 AI)

将下方整段复制到龙虾中文库对话中,由龙虾按 SKILL.md 完成安装。

请把本段交给龙虾中文库(龙虾 AI)执行:为本机安装 OpenClaw 技能「NCCU OJ」。简介:Solve competitive programming problems on NCCUOJ (https://nccuoj.ebg.tw). Use w…。
请 fetch 以下地址读取 SKILL.md 并按文档完成安装:https://raw.githubusercontent.com/openclaw/skills/refs/heads/main/skills/andyjjrt/nccuoj/SKILL.md
(来源:yingzhi8.cn 技能库)

SKILL.md

打开原始 SKILL.md(GitHub raw)

---
name: nccuoj
description: "Solve competitive programming problems on NCCUOJ (https://nccuoj.ebg.tw). Use when: solving OJ problems, reading problem statements, writing solutions in C/C++/Python, submitting code, checking submission results."
argument-hint: "Problem ID or URL (e.g. '1001' or 'https://nccuoj.ebg.tw/problem/1001')"
---

# NCCUOJ Problem Solving

Solve competitive programming problems on [NCCUOJ](https://nccuoj.ebg.tw), a QDU-based Online Judge for NCCU CS.

## When to Use

- Read a problem statement from NCCUOJ
- Write a solution for a specific problem
- Submit code and check results
- Debug a wrong answer or time limit exceeded
- Solve contest problems

## Directory Structure

All generated files are organized under `.nccuoj/` at the workspace root:

```
.nccuoj/
├── cookies.txt                                  # Session cookies (auto-managed)
└── solution/
    ├── public/<problem_id>/                      # Public problem solutions
    │   ├── problem.md                            # Problem statement
    │   └── solution.cpp / solution.py / ...      # Solution code
    └── contest/<contest_id>/<problem_id>/        # Contest problem solutions
        ├── problem.md
        └── solution.cpp / solution.py / ...
```

**When writing solution code, always place files in the correct directory.** The scripts' `--save` flag and `get_solution_dir()` helper handle directory creation automatically.

## CSRF Token (Important)

All NCCUOJ API requests require a CSRF token. The provided scripts handle this automatically (via `GET /api/profile` on init). If making manual requests, see [./references/api.md](./references/api.md) for details.

## Scripts

Use these scripts to interact with NCCUOJ. They handle CSRF tokens and session management automatically.

| Script | Purpose |
|--------|--------|
| [get_problem.py](./scripts/get_problem.py) | Fetch problem statement as Markdown (supports `--username`/`--password`, `--contest`, `--raw`) |
| [submit.py](./scripts/submit.py) | Submit code (requires `--username` / `--password` CLI args) |
| [check_result.py](./scripts/check_result.py) | Check submission result, with optional `--poll` |

All scripts use only Python stdlib (no pip install needed).

Scripts are located in this skill's `./scripts/` directory. In the examples below, `$SCRIPTS` refers to the absolute path of that directory. Resolve it relative to this SKILL.md file before running commands.

## Mode A: Public Problem Solving

### 1. Fetch the Problem

Run [get_problem.py](./scripts/get_problem.py) to fetch the problem. **If the problem requires login (e.g. returns "Please login first"), ask the user for their credentials and pass `--username`/`--password`.**

```bash
# Public (no login)
python $SCRIPTS/get_problem.py <problem_id>

# With login
python $SCRIPTS/get_problem.py <problem_id> --username <username> --password <password>
```

Or if given a URL like `https://nccuoj.ebg.tw/problem/1001`, extract `1001` and pass it as the argument.

The output is **formatted Markdown** containing: title, metadata (internal ID, difficulty, time/memory limit, tags), description, input/output format, sample test cases, hint, allowed languages, and statistics. All URL-encoded HTML fields are automatically decoded and converted to Markdown.

Use `--raw` to get the original JSON instead.

### 2. Analyze the Problem

- Identify input/output format from `input_description` and `output_description`
- Study sample cases from `samples`
- Determine constraints (time/memory limits)
- Identify the algorithm or data structure needed

### 3. Write the Solution

Write the solution file in the correct directory:
- **Public**: `.nccuoj/solution/public/<problem_id>/solution.cpp` (or `.py`, `.java`, etc.)
- **Contest**: `.nccuoj/solution/contest/<contest_id>/<problem_id>/solution.cpp`

The supported languages are:

| Language   | API Name      | Notes         |
|------------|---------------|---------------|
| C          | `C`           | GCC, C17      |
| C++        | `C++`         | GCC, C++20    |
| Python     | `Python3`     | Python 3.12   |
| Java       | `Java`        | Temurin 21    |
| Go         | `Golang`      | Go 1.22       |
| JavaScript | `JavaScript`  | Node.js 20    |

**Default to C++ unless the user specifies otherwise.**

#### C/C++ Template

```cpp
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // solution
    return 0;
}
```

#### Python Template

```python
import sys
input = sys.stdin.readline

def solve():
    # solution
    pass

solve()
```

### 4. Test Locally

Before submitting, verify the solution against the sample cases. Run the code with each sample input and compare to expected output.

### 5. Submit (Optional)

**Before submitting, if the user has not provided their NCCUOJ username and password, ask them for it.** Then pass the credentials directly as CLI arguments.

```bash
# Submit (problem_id is the internal numeric ID from the problem JSON's "id" field)
python $SCRIPTS/submit.py <problem_internal_id> "C++" .nccuoj/solution/public/<problem_id>/solution.cpp --username <username> --password <password>

# Check result (with --poll to wait for judging)
python $SCRIPTS/check_result.py <submission_id> --username <username> --password <password> --poll
```

Result codes: `-2` (Compile Error), `-1` (Wrong Answer), `0` (Accepted), `1` (Time Limit Exceeded), `2` (Memory Limit Exceeded), `3` (Runtime Error), `4` (System Error), `6` (Pending), `7` (Judging), `8` (Partial Accepted).

### 6. Debug if Needed

If the submission is not Accepted:

- **Wrong Answer**: Re-examine edge cases, off-by-one errors, output format
- **Time Limit Exceeded**: Optimize algorithm complexity, reduce I/O overhead
- **Runtime Error**: Check array bounds, division by zero, stack overflow
- **Compile Error**: Check the error info in submission response
- **Memory Limit Exceeded**: Reduce data structure size, avoid unnecessary copies

## Mode B: Contest Problem Solving

Contest mode mirrors public mode but all API calls require the `contest_id` parameter.

### 1. Fetch Contest Problem

Run [get_problem.py](./scripts/get_problem.py) with `--contest`. **Contest problems always require login.**

```bash
python $SCRIPTS/get_problem.py <problem_id> --contest <contest_id> --username <username> --password <password>
```

The response format is the same as public problems.

### 2–4. Analyze, Write, Test

Same as Mode A steps 2–4.

### 5. Submit to Contest

**Before submitting, if the user has not provided their NCCUOJ username and password, ask them for it.**

```bash
python $SCRIPTS/submit.py <problem_internal_id> "C++" .nccuoj/solution/contest/<contest_id>/<problem_id>/solution.cpp --username <username> --password <password> --contest <contest_id>

# Check result
python $SCRIPTS/check_result.py <submission_id> --username <username> --password <password> --poll
```

### 7. Debug if Needed

Same as Mode A step 6. Note: contest submissions **cannot be shared** while the contest is underway.

## API Reference

See [./references/api.md](./references/api.md) for full API endpoint documentation.