JS基础,100元超市买东西,刚好花完有多少种方案?

小雪拿了100元到超市买东西,毛巾5元一条,牙刷2元一支,牙膏10元一支,刚好花完有多少种购买方式?

<script>

var i = 0;
        for (var a = 0; a <= 20; a++) {
            for (var b = 0; b <= 50; b++) {
                for (var c = 0; c <= 10; c++) {
                    if (a * 5 + b * 50 + c * 10 == 100) {
                        i++;
                        document.write('第' + i + '种方案:毛巾' + a + '条,牙刷' + b + '支,牙膏' + c + '支' + '</br>');
                    }
                }
            }
        }
        document.write("一共有" + i + "种可能性!"); 

    </script>

 输出的结果如下:

如果对你有帮助,请点个赞吧!,谢谢~

你好,作为AI语言模型,我可以帮你提供HTML和CSS的代码样本,但不支持图片。 以下是一个HTML5和CSS的小女孩样本: ``` <!DOCTYPE html> <html> <head> <title>小女孩儿</title> <style> body { background-color: #f8c7cc; margin: 0; padding: 0; font-family: sans-serif; text-align: center; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; } .head { width: 120px; height: 120px; background-color: #f1b7be; border-radius: 60px; position: relative; } .hair { position: absolute; background-color: #d28b8f; width: 80px; height: 80px; border-radius: 40px; top: -30px; left: 20px; } .eyes { position: absolute; top: 40px; left: 30px; width: 30px; height: 30px; border-radius: 50%; background-color: #fff; border: solid 5px #d28b8f; } .eye-ball { position: absolute; width: 10px; height: 10px; background-color: #000; border-radius: 50%; top: 9px; left: 7px; } .cheeks { position: absolute; top: 60px; left: 15px; width: 50px; height: 30px; background-color: #f8a4ae; border-radius: 50%; transform: rotate(-30deg); } .nose { position: absolute; top: 70px; left: 30px; width: 15px; height: 10px; background-color: #d28b8f; border-radius: 50%; transform: rotate(-15deg); } .mouth { position: absolute; top: 85px; left: 20px; width: 60px; height: 30px; border-radius: 50% 50% 0 0; background-color: #f5a5b0; transform-origin: bottom center; transform: rotate(-20deg); } .teeth { position: absolute; top: 85px; left: 20px; width: 20px; height: 10px; background-color: #fff; border-radius: 50%; transform-origin: bottom center; transform: rotate(-20deg); } .hair-band { position: absolute; top: 30px; left: 60px; width: 10px; height: 30px; background-color: #d28b8f; border-radius: 50%; transform: rotate(-20deg); } .hair-band:after { content: ""; position: absolute; width: 60px; height: 10px; background-color: #d28b8f; top: 10px; left: -25px; border-radius: 20px; transform: rotate(-45deg); } .hair-band:before { content: ""; position: absolute; width: 70px; height: 10px; background-color: #d28b8f; top: 10px; left: -35px; border-radius: 20px; transform: rotate(-45deg); } .neck { position: absolute; top: 140px; left: 60px; width: 70px; height: 20px; background-color: #f1b7be; border-radius: 20px; transform: rotate(-20deg); } .body { position: absolute; top: 160px; left: 70px; width: 150px; height: 220px; background-color: #f5a5b0; border-radius: 50% 50% 0 0; transform: rotate(-20deg); } .skirt { position: absolute; top: 300px; left: 75px; width: 100px; height: 80px; background-color: #f8a4ae; border-radius: 0 0 50% 50%; transform: rotate(-15deg); } .socks { position: absolute; top: 380px; left: 90px; width: 60px; height: 30px; background-color: #f5a5b0; border-radius: 0 0 50% 50%; transform: rotate(-15deg); } .foot { position: absolute; top: 410px; left: 100px; width: 40px; height: 20px; background-color: #f8a4ae; border-radius: 50% 50% 0 0; transform: rotate(-15deg); } </style> </head> <body> <div class="head"> <div class="hair"></div> <div class="eyes"> <div class="eye-ball"></div> <div class="eye-ball" style="left: 15px;"></div> </div> <div class="cheeks"></div> <div class="nose"></div> <div class="mouth"> <div class="teeth"></div> </div> <div class="hair-band"></div> </div> <div class="neck"></div> <div class="body"></div> <div class="skirt"></div> <div class="socks"></div> <div class="foot"></div> </body> </html> ``` 你可以使用这段代码运行这个小女孩的页面,但是请注意这只是一份示例代码。如果你有特定的细节要求,请自行作出调整。 希望这可以帮到你。如有疑问,欢迎随时回复。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值