From bcf24085f9c6bd99b683a69b87db2efa25fdad25 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Sat, 3 Jan 2026 22:48:38 +0800 Subject: [PATCH] fix --- class_pk/views/oj.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/class_pk/views/oj.py b/class_pk/views/oj.py index 80392d3..b547862 100644 --- a/class_pk/views/oj.py +++ b/class_pk/views/oj.py @@ -218,8 +218,9 @@ class ClassPKAPI(APIView): top_25_avg = statistics.mean(ac_list[:top_25_count]) if top_25_count > 0 else 0 bottom_25_avg = statistics.mean(ac_list[-bottom_25_count:]) if bottom_25_count > 0 else 0 - # 优秀率(AC数 >= 平均值的1.5倍) - excellent_threshold = avg_ac * 1.5 + # 优秀率(AC数 >= 中位数 + 标准差) + # 使用中位数+标准差方法,既不受极端值影响,又能反映班级差异 + excellent_threshold = median_ac + std_dev if std_dev > 0 else median_ac * 1.5 excellent_count = sum(1 for ac in ac_list if ac >= excellent_threshold) excellent_rate = (excellent_count / user_count * 100) if user_count > 0 else 0