
codeforces
文章平均质量分 54
Skyed.blue
写写博客,记录足迹
展开
-
【leetcode】rand7()实现rand10()
已有方法 rand7 可生成 1 到 7 范围内的均匀随机整数,试写一个方法 rand10 生成 1 到 10 范围内的均匀随机整数。不要使用系统的 Math.random() 方法。示例 1:输入: 1输出: [7]示例 2:输入: 2输出: [8,4]示例 3:输入: 3输出: [8,1,10]提示:rand7 已定义。传入参数: n 表示 rand10 的调用次数。进阶:rand7()调用次数的 期望值 是多少 ?你能否尽量少调用 rand7() ?思路分析首先,r原创 2021-03-23 12:23:57 · 428 阅读 · 0 评论 -
【codeforces】sweet Problem (规律,二分)
You have three piles of candies: red, green and blue candies:the first pile contains only red candies and there are rr candies in it,the second pile contains only green candies and there are gg cand...原创 2019-12-02 15:28:53 · 429 阅读 · 0 评论