There are three kinds of red, white, black ball several, including red, white ball a total of 25, white, black ball a total of 31, red, black ball a total of 28, beg this three kinds of ball each how many?
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title> <styletype= "Text/css">Table{Border-collapse:collapse; } </style> <Scripttype= "Text/javascript">document.write ("question 12th"); document.write ("<br/>"); varx, Y, Z for(x=1; x<= -; x++){ for(y=1; y<= -; y++){ for(z=1; z<= -; z++){ if(x+y== -&&y+Z== to&&x+Z== -) {document.write ("x"+x+"y"+y+"Z"+z); Break; } } } } //a different approach for(x=1; x< *; x++) {y= --x; Z= --x; if(y+Z== to) document.write ("<br/>x"+x+"y"+y+"Z"+z); } document.write (""); </Script></Head><Body></Body></HTML>
The second solution is much more efficient than the first, as long as the cycle is more than 10 more than one can produce results, the first to thousands of
"2016.12.07" javascript exercises