- Lucky Draw 是如何解决的呢
In the Lucky village, people are crazy on a game called Lucky Draw. In this game, N players stand in a line, and each one is assigned an integer number. Then, the village master would randomly choose K continuous players. Among these K players, the one who has the largest number will win the first prize of A dollars. Also, the one with the second smallest number will win the second prize of B dollars. Different players may have same numbers. As an agreement, only the rightmost player who has the largest number owns the first prize, and the leftmost player who has the second smallest number owns the second prize. Note that the second smallest number should be greater than the smallest number. Therefore, if all of these K players have the same number, no one will win the second prize.
A big problem in this game is about fairness. Some players may have much more chance to win prizes than others. So, the village master wants to know how fair the game is. You should tell the village master how many players have the opportunity to win the prize. In addition, you need to calculate the variance of the expected prize moneys of these potential prize winners.
The first line contains four integers, N, K, A, B, as described before. (1 ≤ K ≤ N ≤ 1000000, 1 ≤ A, B ≤ 1000).
The second line contains N integers, indicate the numbers assigned to those players, listed from left to right. The numbers are guaranteed to fit in 32-bit signed integers.
Output only one line containing an integer M and a real number V, separated by a single space. M is the number of players who have any chance to win the prize money. V is the variance of the expected prize money of these M players, rounded to four digits after the decimal point.
6 3 1 2
1 2 1 3 3 3
- 学院 程序员的兼职技能课
- 学院 Windows版YOLOv4目标检测实战：训练自己的数据集
- 下载 lena全身原图(非256*256版本,而是全身原图)
- 学院 快速入门Android开发 视频 教程 android studio
- 博客 Java调用微信支付
- 下载 汽车租赁管理系统需求分析规格说明书
- 学院 程序员的算法通关课：知己知彼（第一季）
- 学院 机器学习初学者必会的案例精讲
- 学院 Python入门视频精讲
- 博客 我以为我对Mysql事务很熟，直到我遇到了阿里面试官
- 下载 Java62数据提取代码
- 博客 Python代码实现飞机大战
- 下载 2018年全国大学生计算机技能应用大赛决赛 大题
- 下载 Lena图像处理测试专业用图，高清完整全身原图
- 博客 MySQL数据库面试题（2020最新版）
- 下载 verilog实现地铁系统售票
- 学院 Python+OpenCV计算机视觉
- 学院 Python可以这样学（第四季：数据分析与科学计算可视化）
- 学院 150讲轻松搞定Python网络爬虫
- 下载 获取Linux下Ftp目录树并逐步绑定到treeview
- 学院 手把手实现Java图书管理系统（附源码）
- 学院 微信小程序开发实战之番茄时钟开发
- 博客 Java 最常见的 200+ 面试题：面试必备
- 博客 Java基础知识面试题（2020最新版）
- 学院 三个项目玩转深度学习（附1G源码）
- 下载 微信小程序 实例汇总 完整项目源代码
- 下载 基于西门子S7—1200的单部六层电梯设计程序，1部6层电梯