public int rand9() { int x = 0; while (x > 45) { x = 7 * (rand7() - 1) + rand7(); //随机生成1-49 } return x % 9 + 1; } private int rand7() { //... }
点赞 6

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务