版本比较
OJ运维模拟器真的合理吗?
正文
增加 4 行删除 4 行
13 行未改动141516171818192021222324252627282829303031323334353637373839404122 行未改动13 行未改动模拟器中用户增长计算代码如下(大家应该能看懂吧)。```javascript let rep = this.stats.reputation; let total_users = u.normal + u.active + u.core;
let pct_rate = (rep * 8 + 4) / 100; if (pct_rate < 0) pct_rate = 0; let growth_from_pct = total_users * pct_rate; let growth_from_fixed = (rep + 1) * 50; if (growth_from_fixed < 0) growth_from_fixed = 0;
let new_users = Math.floor(growth_from_pct + growth_from_fixed); if (this.flags.contest_growth_mult !== 1.0) { new_users = Math.floor(new_users * this.flags.contest_growth_mult); this.flags.contest_growth_mult = 1.0; this.flags.contest_growth_mult = 1.0; }
// 新增:搬题奖励发放 if (this.stats.pending_user_bonus > 0) { new_users += this.stats.pending_user_bonus; ui.log(`推广: 试题扩充吸引了额外 ${this.stats.pending_user_bonus} 名用户`); this.stats.pending_user_bonus = 0; }
u.normal += new_users; if (new_users > 0) ui.log(`用户: 新增 ${new_users} 人`);```我们认为`this.flags.contest_growth_mult`为 $1.1$ ,因为模拟器中比赛导致的用户增长不能叠加,所以只要举办了比赛,就能达到 $1.1$。22 行未改动