Blogger Information
Blog 263
fans 3
comment 2
visits 113341
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
百牛百钱
福哥的博客
Original
883 people have browsed it
<?php
//百牛百钱 公牛5文一只,母牛3文一只,小牛1文3只
//一百只牛刚好100文钱
//正常思维 x+y+z=100 5x+3y+1/3z=100;
//代码逻辑 枚举法 6数字 000000-999999
//公牛数量0-100 母牛0-100 小***0-100
//公牛$x只 ,母牛$Y只,小牛$z只
header("Content-type:text/html;charset=utf-8;");
for($x=0;$x<=100;$x++){
    
    for($y=0;$y<=100;$y++){
        
        for($z=0;$z<=100;$z++){
            if(($x+$y+$z==100)&&($x*5+$y*3+$z/3==100)){
            echo "公牛{$x}只,母牛{$y}只,小牛{$z}只<br />";
            }
        }
    }
}
?>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post