Graps/白鸡百钱/七星彩
来源:互联网 发布:用矩阵解决实际问题 编辑:程序博客网 时间:2024/05/16 05:29
package day141018;<pre name="code" class="java">/** * * Graps赌博 * @author XWJ * */public class Graps { public static int roll() { return (int)(Math.random() * 6 + 1); } public static void main(String[] args) {int firstPoint, currentPoint;firstPoint = currentPoint = roll() + roll();System.out.println("玩家摇出了" + currentPoint + "点");boolean goon = false;switch(currentPoint) {case 7:case 11:System.out.println("玩家胜!!!");break;case 2:case 3:case 12:System.out.println("庄家胜!!!");break;default:goon = true;}while(goon) {currentPoint = roll() + roll();System.out.println("玩家摇出了" + currentPoint + "点");if(currentPoint == 7) {System.out.println("庄家胜!!!");goon = false;}else if(currentPoint == firstPoint) {System.out.println("玩家胜!!!");goon = false;}}}}
package day141018;/** * * 白鸡百钱方法2 * * @author XWJ * */public class MoneyAndChicken {public static void main(String[] args) {for (int x = 0; x <= 20; x++) {for (int y = 0; y <= 33; y++) {int z = 100 - x - y;if (5 * x + 3 * y + z / 3 == 100 && z % 3 == 0) {System.out.printf("公鸡的数量:%d,母鸡的数量:%d,小鸡的数量:%d,\n", x, y, z);}}}}}
package day141018;/** * * 七星彩计算 * @author XWJ */import java.util.Scanner;public class SevenColor {public static void main(String[] args) {Scanner a = new Scanner(System.in);System.out.print("请输入要下的注数:");if (a.hasNextInt()) {int x = a.nextInt();if (x > 0) {for (int i = 1; i <= x; i++) {for (int j = 1; j <= 7; j++) {System.out.print((int) (Math.random() * 10) + " ");}System.out.println();a.close();}}}}}
0 0
- Graps/白鸡百钱/七星彩
- 百钱白鸡问题
- 百钱白鸡问题
- 百钱白鸡问题
- 百钱白鸡问题
- C++百钱白鸡问题
- 第三周项目百钱白鸡问题
- c++实验4-百钱白鸡问题
- 算法学习之百钱白鸡
- 百钱与白鸡的问题
- java百钱白鸡的算法
- 第九周项目六 百钱白鸡问题
- 1.1算法入门之百钱白鸡问题
- php穷举思维探究百钱白鸡问题
- C#基础的流程语句(九九乘法表)(百钱白鸡)
- 穷举算法(鸡兔同笼与百钱白鸡)
- 第3周项目4-穷举法解决组合问题(百钱白鸡问题)
- C++作业四—分数的累加,星形图案,百钱白鸡问题
- CSS优先级,优先级计算
- C语言中char * 与char[]详解
- QPSK信号调制与解调
- 圣杯布局
- ONVIF 自定义soap结构体实现用户认证
- Graps/白鸡百钱/七星彩
- 【iOS开发-56】案例BUG:按钮的enabled、控件的userInteractionEnabled以及两种提示框UIAlert和UIActionSheet
- C Char* Char[] sizeof
- arcmap坐标点生成线和面(更正版)
- Ubuntu 11.04 下安装配置 JDK 7
- 我的自述,我的自我评价,认识自己,升华自己
- 一个完整的项目流程是确保项目顺利进行的关键
- 用VS2013建一个C++程序
- wdk学习之路