当前位置:网站首页>权重等比分配
权重等比分配
2022-08-01 05:21:00 【時間不夠以後】
function getA(total, len){
// 正常情况下,返回有len个元素的数组,每个元素是对应任务数
if(total<0 || len<=0) return []; // 返回为空数组表示输入数据有错
var avgNum = Math.floor(total / len / total * 10000) / 100 // 平均数
var avgAll = Math.floor(avgNum * len * 100) / 100 // 平均数总和
var rest = Math.floor((total - avgAll) * 100) / 100
var res=[]
let i=-1
while(++i<len){
let tem=avgNum;
if(i < rest * 100) {
tem = Math.round((tem + 0.01) * 100) / 100.00
}
res.push(tem)
}
return res;
}
console.log(getA(100, 15))
function average(t, c) {
var l = [], a = t / c | 0, b = t % c, i = -1;
while (++i < c) l[i] = +(i < b) + a;
return l;
}
console.log(average(100, 15))
边栏推荐
猜你喜欢
pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
[target detection] YOLOv7 theoretical introduction + practical test
冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
pytroch、tensorflow对比学习—使用GPU训练模型
Check控件
DL-31/6电流继电器
牛客多校2022第四场A,H,K,N
(Codeforce 757)E. Bash Plays with Functions(积性函数)
Robot_Framework: Assertion
随机推荐
图片更新之后Glide加载依旧是原来的图片问题
Selenium: element positioning
matplotlib pyplot
pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
leetcode43 字符串相乘
Seleniu:元素常用操作
(Codeforce 757)E. Bash Plays with Functions(积性函数)
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
Selenium: Manipulating Cookies
vim配置+ctag像source insight一样方便阅读代码
Speed up your programs with bitwise operations
WPF项目-按着键盘方向键,移动格子盒子效果
Robot_Framework: commonly used built-in keywords
(2022牛客多校四)A-Task Computing (排序+动态规划)
可视化全链路日志追踪
Robot_Framework:断言
PAT serie b write the number 1002
PAT class B 1001 (3n+1) conjecture
Selenium: browser operation