(nSubmit: number, nAccept: number)
| 35 | } |
| 36 | |
| 37 | function difficultyAlgorithm(nSubmit: number, nAccept: number) { |
| 38 | if (!nSubmit) return null; |
| 39 | const s = _integrate(nSubmit); |
| 40 | const acRate = nAccept / nSubmit; |
| 41 | const ans = Math.round(10 - 13 * s * acRate); |
| 42 | return Math.max(ans, 1); |
| 43 | } |
| 44 | |
| 45 | export default difficultyAlgorithm; |