function aoyuntimelist() {
nowdate = new Date();
year = nowdategetFullYear();
month = nowdategetMonth()+1;
date = nowdategetDate();
day = nowdategetDay();
hour = nowdategetHours();
minute = nowdategetMinutes();
second = nowdategetSeconds();
enddate = new Date(2010, 9, 1, 0, 0, 0);
shijiancha = (enddategetTime()-nowdategetTime())/1000;
if (shijiancha>=0) {
shengyutian = Mathfloor(shijiancha/(360024));
shengyuxiaoshi = Mathfloor((shijiancha-shengyutian243600)/3600);
shengyufen = Mathfloor((shijiancha-shengyutian243600-shengyuxiaoshi3600)/60);
shengyumiao = Mathfloor(shijiancha-shengyutian243600-shengyuxiaoshi3600-shengyufen60);
if (month<10) {
month = "0"+month;
}
if (date<10) {
date = "0"+date;
}
if (hour<10) {
hour = "0"+hour;
}
if (minute<10) {
minute = "0"+minute;
}
if (second<10) {
second = "0"+second;
}
if (shengyutian<10) {
shengyutian = "0"+shengyutian;
}
if (shengyuxiaoshi<10) {
shengyuxiaoshi = "0"+shengyuxiaoshi;
}
if (shengyufen<10) {
shengyufen = "0"+shengyufen;
}
if (shengyumiao<10) {
shengyumiao = "0"+shengyumiao;
}
txt1 = "2010年10月1日距我们结婚还有"+String(shengyutian)+"天"+String(shengyuxiaoshi)+"时"+String(shengyufen)+"分"+String(shengyumiao)+"秒";
txt2 = "今天是"+year+"年"+month+"月"+date+"日"+"星期"+day+"现在时刻"+hour+":"+minute+":"+second;
//txt1和txt2是两个动态文本框的变量名
} else {
if (month<10) {
month = "0"+month;
}
if (date<10) {
date = "0"+date;
}
if (hour<10) {
hour = "0"+hour;
}
if (minute<10) {
minute = "0"+minute;
}
if (second<10) {
second = "0"+second;
}
if (shengyutian<10) {
shengyutian = "0"+shengyutian;
}
if (shengyuxiaoshi<10) {
shengyuxiaoshi = "0"+shengyuxiaoshi;
}
if (shengyufen<10) {
shengyufen = "0"+shengyufen;
}
if (shengyumiao<10) {
shengyumiao = "0"+shengyumiao;
}
txt1 = "倒计时已经结束!祝我们新婚快乐!";
txt2 = "今天是"+year+"年"+month+"月"+date+"日"+"星期"+day+"现在时刻"+hour+":"+minute+":"+second;
}
}
setInterval(aoyuntimelist, 1000);
//以下是声音的链接和播放
mysound = new Sound();
mysoundattachSound(id="music");
mysoundstart(0, 20);
大致算法:
首先排列好K个家属,并且记录下家属们的最大和最小值。
然后插入其余客人。
如果客人的身高大于已经排好的最大值,那么这个客人放在最大值的旁边(左右都行),然后更新最大值为此客人的身高。
如果客人的身高小于最小值,那么这个客人放在最小值的旁边,然后更新最小值。
如果客人的身高介于最大值和最小值之间,那么在已排好的客人里一定至少存在相邻的两个人,一个身高大于他,一个身高小于他。搜索满足这个条件的两个人,把客人插入他们俩之间。
程序代码就不写了
欢迎分享,转载请注明来源:浪漫分享网
评论列表(0条)