当前位置:网站首页>weight distribution
weight distribution
2022-08-01 05:33:00 【not enough time later】
function getA(total, len){
// 正常情况下,返回有len个元素的数组,Each element is the number of corresponding tasks
if(total<0 || len<=0) return []; // Returning an empty array indicates that the input data is incorrect
var avgNum = Math.floor(total / len / total * 10000) / 100 // 平均数
var avgAll = Math.floor(avgNum * len * 100) / 100 // sum of averages
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))
边栏推荐
- 关于给Qt做一个软件初始化的进度条
- 数据湖:数据同步工具NiFi
- Selenium: browser operation
- NDK does not contain any platforms problem solving
- 类神经网络训练不起来怎么办
- 小白的0基础教程SQL: 关系数据库概述 02
- pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
- Swastika line-by-line parsing and realization of the Transformer, and German translation practice (a)
- Selenium:元素定位
- 深度比较两个对象是否相同
猜你喜欢

WebSocket implements chat function

NDK does not contain any platforms问题解决

2022年超全的Android面经(附含面试题|进阶资料)

(Codeforce 757) E. Bash Plays with Functions

leetcode125 Verify palindrome string

pytorch、tensorflow对比学习—计算图和微分机制

WPF入门项目必知必会-初步了解数据绑定 binding

字符中的第一个唯一字符

戴尔PowerEdge服务器R450 RAID配置步骤

移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
随机推荐
2022年超全的Android面经(附含面试题|进阶资料)
The sword refers to Offer 68 - I. Nearest Common Ancestor of Binary Search Trees
Selenium:弹窗处理
torch
uva12326
2022年湖南工学院ACM集训第六次周测题解
vsce package 后出现 Command failed: npm list --production --parseable --depth=99999 --loglevel=error异常
I met a shell script
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
微信小程序获取手机号phonenumber.getPhoneNumber接口开发
2022/07/29 入职健海JustFE团队,我学到了高效开发(年中总结)
使用string 容器翻转 字母
用位运算为你的程序加速
About making a progress bar for software initialization for Qt
Asynchronous reading and writing of files
Selenium:元素判断
JWL-11/2-99.9A电流继电器
2022.7.27 Selected lectures on good topics
Dialogue with the father of MySQL: One excellent programmer is worth 5 ordinary programmers
Robot_Framework: keyword