clang-format 不认中文分号、缺了分号的语句,会把它和下一行并起来(int n; 和 scanf 成了 一行),报错的行号也对不上学生记得的位置。现在 C / C++ 格式化之前先套上题目模板、在 判题机上编一次,编不过就原样返回、不格式化,代码照常提交、照常判成编译错误。 api 容器里没有 gcc,判题机的编译器和参数本来就是判的标准,所以借它编。这一下不进判题 队列、不建提交记录;判题机连不上时照旧格式化。代价是每次交 C 多一次编译,零点几秒。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fa092d334c
commit
c2ef55b10b
5 files changed
+51
-3
No files matched your search
@@ -534,6 +534,8 @@ export const todaySubmissionStatisticsSchema = z.object({
|
||||
export const formatCodeRequestSchema = z.object({
|
||||
code: z.string().max(1024 * 1024),
|
||||
language: z.enum(["python", "c", "cpp", "sql"]),
|
||||
/** C / C++ 格式化前要先编一遍,得套上这道题的模板才编得过 */
|
||||
problemId: z.number().int().optional(),
|
||||
})
|
||||
|
||||
export const formatCodeResponseSchema = z.object({ code: z.string() })
|
||||
|
||||
Reference in new issue
Block a user