Install lingo14 during Fedora 21
The first step:Download lingo14
Download address:http://www.lindo.com/index.php?option=com_content&view=article&id=35&Itemid=20.
The second step:Install lingo14
In terminal, inputting:
tar -xzvf LINGO-LINUX-64x86-14.0.tar.gz##Extracting LINGO-LINUX-64x86-14.0.tar.gz
sudo mv lingo14 /home##Moving lingo14 file to /home
cd /bin##open bin file
sudo nano lingo##Editing lingo shell
##copy codes to lingo
#!/bin/bash
LINGO64_14_LICENSE_FILE=/home/lingo14/license/linux64/lndlng64_14_demo.lic
export LINGO64_14_LICENSE_FILE
/home/lingo14/bin/linux64/lingo64_14
##After editing lingo shell
sudo chmod 777 lingo
本文链接:Fedora 21下lingo14配置,转载请注明。
最近在群里抢红包,抢的甚是开心,似乎这已经过时了,但发钱总是好的嘛,哈哈,熟悉了红包的规则,就自己编了个小程序,模拟下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload=function()
{ var aResult=[];
var dollar=document.getElementById("m");
var count=document.getElementById("r");
var star=document.getElementById("start");
var oUl=document.getElementById("ull");
star.onclick=ss;
//查找所有的随机数
function redbag(money,count)
{
var num=0;
if(count==1)
{
aResult.push(money);
return;
}
else
{
num=parseInt(Math.random()*money)+1;
money=money-num;
aResult.push(num);
redbag(money,count-1);
}
}
// 检验随机数是否都大于零
function check()
{
var b=true;
for(var i=0;i<aResult.length;i++)
{
if(aResult>0)
{
continue;
}
else
{
b=false;
break;
}
}
return b;
}
//结合
function ss()
{
aResult.length=0;
redbag(dollar.value,count.value);
check();
while(!check())
{ aResult.length=0;
redbag(dollar.value,count.value);
check();
}
li=document.createElement("li");
li.innerHTML=aResult;
oUl.appendChild(li);
}
}
</script>
</head>
<body>
金额:<input type="text" id="m"/>
红包数:<input type="text" id="r"/>
<input type="button" value="发放" id="start"/>
<ul id="ull">
</ul>
</body>
</html>
写的这个程序,复杂度高点,望大神给点指点哈
本文链接:红包算法设计,转载请注明。
没有评论:
发表评论