任务非常简单,但解决方案并不明确,我多次询问神经网络,每个请求都有不同数量的受影响行
主页
/
user-543736
David Meyster's questions
我用谷歌搜索,发现了一些显而易见的东西,一如既往的拐杖:
input:-webkit-autofill {
transition: all 5000s ease-in-out 0s;
}
或者
-webkit-box-shadow: 0 0 0px 1000px (цвет который будет перекрывать) inset !important;
伪解决方案:
autocomplete="off"
嗯,我自己尝试了一下:
.modal .input-container input:autofill,
.modal .input-container input:-webkit-autofill,
.modal .input-container input:-webkit-autofill-strong-password,
.modal .input-container input:-webkit-autofill-strong-password-viewable,
.modal .input-container input:-webkit-autofill-and-obscured {
background-color: transparent !important;
}
没有帮助。所有测试均在 Safari 中进行
从3.0版本开始,如文档中所示jQuery
,该功能ready
不再需要使用,我想问的是,真的可以用它代替ready
吗$()
?
例子:
$(document).ready(function () {
console.log('DOM загружен с помощью ready!');
});
$(function () {
console.log('DOM загружен с помощью $()!');
});
是否也可以使用该方法直接调用函数?
例子:
function hi(text) {
console.log(text);
}
$(hi('123'));
由于 ,此示例中的滑块应为红色background: red;
,但它仍然是蓝色:
.slider {
border: 0;
outline: 0;
width: 100px;
background: red;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: red;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: red;
cursor: pointer;
}
.slider::-ms-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: red;
cursor: pointer;
}
<input class="slider" type="range" min="0" max="100">
您需要创建一个用于丢弃对象的算法。
输入数据:
open_cost
- 开业成本。
items
- 一系列可以掉落的物品。
item['cost']
- 项目的成本单独。
您还可以使用:
items_count
- 所有项目的数量。
items_cost
- 所有项目的成本。
等等。
该算法应该平均给出一个成本等于发现成本的项目。
我需要一个 php 算法。你可以用任何方便的语言来写,对我来说最主要的是理解原理。
我也有自己的算法,但是它的问题是不同的item需要不同的系数,用selection来找。
这是算法:
function getClosest($search, $array)
{
$num = null;
foreach ($array as $item) {
if ($item['chance'] < $search) {
continue;
}
if ($num === null || $item['chance'] < $num['chance']) {
$num = $item;
}
}
return $num;
}
function getRandomSkin($items, $open_cost, $coeff)
{
$accum = 0;
foreach ($items as &$item) {
if ($open_cost >= $item['cost']) {
$chance = $item['cost'] / $open_cost * $coeff;
} else {
$chance = $open_cost / $item['cost'];
}
$item['chance'] = round($chance, 3) * 1000;
$accum = $skin['chance'] += $accum;
}
$rand_num = rand(0, end($items)['chance']);
$rand_element = getClosest($rand_num, $items);
return $rand_element;
}
例子:
$items = [
['id' => 1, 'cost' => 50],
['id' => 2, 'cost' => 100],
['id' => 3, 'cost' => 10],
['id' => 4, 'cost' => 200],
];
$open_cost = 50;
根据这些数据,掉落物品的几率应该如下:
Формула - $item['cost'] / $open_cost
id_1 - 1
id_2 - 2
id_3 - 5
id_4 - 4
数字越低,掉落的几率就越大。