25C开源项目热度榜单(JS 100)

<!DOCTYPE html>
<html>
<body>

<p>华为OD机试 - 开源项目热度榜单(JS 2025C卷 100分)</p >

<p id="demo"></p >

<script>
/*
	var input = [];
    let count = 0;
	while(line = await readline()){
    	input[count] = line.split(' ');
        count++;
    }
*/
var input = [];
input[0] = "4";
input[1] = "8 6 2 8 6";
input[2] = "camila 66 70 46 158 80";
input[3] = "victoria 94 76 86 189 211";
input[4] = "anthony 29 17 83 21 48";
input[5] = "emily 53 97 1 19 218";
var w = input[1].split(" ").map(Number);
var demo = new Map();
let n = Number(input[0]);
for(let i = 0; i < n ;i++){
	let arr = input[2+i].split(" ");
    let h = 0;
    for(let j = 1; j < arr.length; j++){
    	h += arr[j] * w[j-1];
    }
    demo.set(arr[0],h);
}
//console.log(demo);
let ans = Array.from(demo.entries()).sort((a,b)=>{ 
	if(b[1] - a[1] !== 0) return b[1] - a[1];
    else return a[0] - b[0];
});
//console.log(ans);
for(let i = 0; i<ans.length; i++){
	console.log(ans[i][0].toLowerCase());
}
document.getElementById("demo").innerHTML = ans;

//console.log(ans);
</script>

</body>
</html>

仅过测试用例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值