11a15 rules!
<script>
var pictureSrc ="dandd/hoamai.png"; //the location of the snowflakes
var pictureWidth = 30; //the width of the snowflakes
var pictureHeight = 30; //the height of the snowflakes
var numFlakes = 5; //the number of snowflakes
var downSpeed = 0.01; //the falling speed of snowflakes (portion of screen per 100 ms)
var lrFlakes = 10; //the speed that the snowflakes should swing from side to side


if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; }

//draw the snowflakes
for( var x = 0; x < numFlakes; x++ ) {
if( document.layers ) { //releave NS4 bug
document.write('<layer id="snFlkDiv'+x+'"><imgsrc="'+pictureSrc+'" height="'+pictureHeight+'"width="'+pictureWidth+'" alt="*" border="0"></layer>');
} else {
document.write('<div style="position:absolute;"id="snFlkDiv'+x+'"><img src="'+pictureSrc+'"height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*"border="0"></div>');
}
}

//calculate initial positions (in portions of browser window size)
var xcoords = new Array(), ycoords = new Array(), snFlkTemp;
for( var x = 0; x < numFlakes; x++ ) {
xcoords[x] = ( x + 1 ) / ( numFlakes + 1 );
do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() );
} while( typeof( ycoords[snFlkTemp] ) == 'number' );
ycoords[snFlkTemp] = x / numFlakes;
}

//now animate
function flakeFall() {
if( !getRefToDivNest('snFlkDiv0') ) { return; }
var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;
//find screen settings for all variations. doing this every time allows for resizing and scrolling
if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else {
if( document.documentElement && (document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } }
if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else {
if( document.body && ( document.body.scrollLeft ||document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop;scrollWidth = document.body.scrollLeft; } else {
if(document.documentElement && (document.documentElement.scrollLeft ||document.documentElement.scrollTop ) ) { scrollHeight =document.documentElement.scrollTop; scrollWidth =document.documentElement.scrollLeft; } }
}
//move the snowflakes to their new position
for( var x = 0; x < numFlakes; x++ ) {
if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; }
var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; }
if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0;
divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix;
divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - (pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * (Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x]) ) ) ) + scrollWidth ) + oPix;
ycoords[x] += downSpeed;
}
}

//DHTML handlers
function getRefToDivNest(divName) {
if( document.layers ) { return document.layers[divName]; } //NS4
if( document[divName] ) { return document[divName]; } //NS4 also
if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)
if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4
return false;
}

window.setInterval('flakeFall();',100);</script>
11a15 rules!
<script>
var pictureSrc ="dandd/hoamai.png"; //the location of the snowflakes
var pictureWidth = 30; //the width of the snowflakes
var pictureHeight = 30; //the height of the snowflakes
var numFlakes = 5; //the number of snowflakes
var downSpeed = 0.01; //the falling speed of snowflakes (portion of screen per 100 ms)
var lrFlakes = 10; //the speed that the snowflakes should swing from side to side


if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; }

//draw the snowflakes
for( var x = 0; x < numFlakes; x++ ) {
if( document.layers ) { //releave NS4 bug
document.write('<layer id="snFlkDiv'+x+'"><imgsrc="'+pictureSrc+'" height="'+pictureHeight+'"width="'+pictureWidth+'" alt="*" border="0"></layer>');
} else {
document.write('<div style="position:absolute;"id="snFlkDiv'+x+'"><img src="'+pictureSrc+'"height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*"border="0"></div>');
}
}

//calculate initial positions (in portions of browser window size)
var xcoords = new Array(), ycoords = new Array(), snFlkTemp;
for( var x = 0; x < numFlakes; x++ ) {
xcoords[x] = ( x + 1 ) / ( numFlakes + 1 );
do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() );
} while( typeof( ycoords[snFlkTemp] ) == 'number' );
ycoords[snFlkTemp] = x / numFlakes;
}

//now animate
function flakeFall() {
if( !getRefToDivNest('snFlkDiv0') ) { return; }
var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;
//find screen settings for all variations. doing this every time allows for resizing and scrolling
if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else {
if( document.documentElement && (document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } }
if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else {
if( document.body && ( document.body.scrollLeft ||document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop;scrollWidth = document.body.scrollLeft; } else {
if(document.documentElement && (document.documentElement.scrollLeft ||document.documentElement.scrollTop ) ) { scrollHeight =document.documentElement.scrollTop; scrollWidth =document.documentElement.scrollLeft; } }
}
//move the snowflakes to their new position
for( var x = 0; x < numFlakes; x++ ) {
if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; }
var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; }
if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0;
divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix;
divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - (pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * (Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x]) ) ) ) + scrollWidth ) + oPix;
ycoords[x] += downSpeed;
}
}

//DHTML handlers
function getRefToDivNest(divName) {
if( document.layers ) { return document.layers[divName]; } //NS4
if( document[divName] ) { return document[divName]; } //NS4 also
if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)
if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4
return false;
}

window.setInterval('flakeFall();',100);</script>
11a15 rules!
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


Nơi dành cho tất cả mem 11a15 và các a khác có thể tự do 8 hay up bất cứ gì mình thích :)
 
Trang ChínhTìm kiếmLatest imagesĐăng kýĐăng Nhập

Share|
Tiêu đề

Bài toán của Anhxtanh

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down
Tác giảThông điệp

Khách vi

Tài năng của Khách vi
Hạng: Khách viếng thăm
Level:
Tài năng:/300

Bài gửiTiêu đề: Bài toán của Anhxtanh Bài toán của Anhxtanh  Icon_minitimeTue Feb 01, 2011 9:29 pm

Bạn có nằm trong số 2% những người thông minh nhất trên thế giới không ?
Bài toán đố dưới đây thực chất là toán logic.
Chúc bạn may mắn và không nản chí !
1. Có 5 ngôi nhà, mỗi nhà một màu khác nhau.
2. Trong mỗi nhà có một người ở, mỗi người có quốc tịch khác nhau.

3. Mỗi người thích uống một loại nước khác nhau, mỗi người hút một loại thuốc lá khác nhau và nuôi một loài vật khác nhau trong nhà của mình.
Câu hỏi đặt ra là: Ai nuôi cá ?
Biết rằng:
a. Người Anh sống trong nhà màu đỏ.
b. Người Thuỵ điển nuôi chó.
c. Người Đan mạch thích uống chè.
d. Người Đức hút thuốc lá nhãn Rothmanns.
e. Người Nauy sống trong ngôi nhà đầu tiên.
f. Người sống trong nhà xanh thích uống cà phê.
g. Người hút thuốc lá Winfield thích uống bia.
h. Người sống trong nhà vàng hút thuốc lá Dunhill.
i. Người hút thuốc lá Pall Mall nuôi vẹt trong nhà của mình.
j. Người sống trong ngôi nhà ở chính giữa thích uống sữa.
k. Người hút thuốc lá Marlboro sống bên cạnh người nuôi mèo.
l. Người hàng xóm của người hút Marlboro quen uống nước.
m. Người hút thuốc lá Dunhill sống bên cạnh người nuôi ngựa.
n. Ngôi nhà của người Nauy nằm bên cạnh nhà màu tím.
o. Ngôi nhà màu xanh nằm kế và bên trái (phía trước) nhà màu trắng.

Anhxtanh đã nghĩ ra bài toán trên ở thế kỷ trước. Ông khẳng định rằng 98% người trên thế giới không thể giải được bài toán đố này. Chúc bạn may mắn!
😕

Hãy cảm ơn bài viết của Khách vi bằng cách bấm vào"" nhé!!!

Về Đầu Trang Go down

Zd0jk0n
Chém gió tướng quân

Zd0jk0n

Tổng số bài gửi : 33
Points : 59
Reputation : 0
Join date : 30/01/2011
Age : 30
Đến từ : 11a15
Tài năng của Zd0jk0n
Hạng: Chém gió tướng quân
Level:33
Tài năng:/300

Bài gửiTiêu đề: Re: Bài toán của Anhxtanh Bài toán của Anhxtanh  Icon_minitimeMon Feb 07, 2011 4:15 pm

a minh` ra bai` nay` ui` nak! ng duc o nha` thu 4 nuoi ca phai ko? ko he^` search google nhe! ^^ chi? kan lap bang? suy ra 2 truong hop , suy luan chut la` ra thui!
mat 45 phut lap bang giai do! minh` dx tinh la` ng thong minh ko ta? Bài toán của Anhxtanh  26835
( ah` ma` u la` ai the^ ???????????)

Hãy cảm ơn bài viết của Zd0jk0n bằng cách bấm vào"" nhé!!!

Về Đầu Trang Go down

Tiêuđề

Bài toán của Anhxtanh

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang
Trang 1 trong tổng số 1 trang
::.
Permissions in this forum:Bạn không có quyền trả lời bài viết
11a15 rules! :: Lớp 11a15 :: Homeworks-