题解 | #掷骰子游戏#

掷骰子游戏

http://www.nowcoder.com/practice/7b543bee3dc14c49a7b340b2e04209ce

import java.util.Random;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int seed = scanner.nextInt();
            Random random = new Random(seed);//伪随机
            
            //write your code here......
            int num=random.nextInt(6)+1;
            System.out.println(num);
        }
    }

}

全部评论

相关推荐

点赞 评论 收藏
分享
VirtualBoo...:都去逗他了?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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