Card Game (Second Edition) FZU - 2265

BLDC方波控制双闭环Simulink仿真模型 无刷直流电机方波控制双闭环Simulink仿真模型搭建详细教程,包括速度PI环、电流PI环、换向逻辑和受控电压源,仿真结果良好。 阅读详情

Card Game (Second Edition)

FZU - 2265

Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck. The game goes for N rounds and in each round, Fat Brother and Maze would draw one card from their own remaining card deck randomly and compare for the integer which is written on the cards. The player with the higher number wins this round and score 1 victory point. And then these two cards are removed from the game such that they would not appear in the later rounds. As we all know, Fat Brother is very clever, so he would like to know the expect number of the victory points he could get if he knows all the integers written in these cards.

Note that the integers written on these N*2 cards are pair wise distinct. At the beginning of this game, each player has 0 victory point.


Input

The first line of the data is an integer T (1 <= T <= 100), which is the number of the text cases.

Then T cases follow, each case contains an integer N (1 <=N<=10000) which described before. Then follow two lines with N integers each. The first N integers indicate Fat Brother’s cards and the second N integers indicate Maze’s cards.

All the integers are positive and no more than 10000000.

Output

For each case, output the case number first, and then output the expect number of victory points Fat Brother would gets in this game. The answer should be rounded to 2 digits after the decimal point.

Sample Input
2
1
1
2
2
1 3
2 4
Sample Output
Case 1: 0.00
Case 2: 0.50

计算a中每个牌得分的概率贡献,即遍历a中的每个牌,然后从b中二分找到小于它的个数,个数/n就是这张牌的贡献最后加起来

code:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a[30005];
int b[30005];
int main(){
    int T,cas = 0;
    cin >> T;
    while(T--){
        int n;
        double ans = 0.0;
        scanf("%d",&n);
        for(int i = 0; i < n; i++){
            scanf("%d",&a[i]);
        }
        for(int j = 0; j < n; j++){
            scanf("%d",&b[j]);
        }
        sort(a,a+n);
        sort(b,b+n);
        for(int i = 0; i < n; i++){
            int cnt = 0;
            int l,r;
            l = 0,r = n-1;
            while(l <= r){
                int mid = l + r >> 1;
                if(b[mid] >= a[i]) r = mid - 1;
                else l = mid + 1;
            }
            cnt = l;
            ans += cnt * 1.0 / n;
        }
        printf("Case %d: %.2f\n",++cas,ans);
    }
    return 0;
}


引以为戒:一个“看不见”的空格,导致上下文超限——从 `llama-server` 错误说起 文章摘要: 本文分享了Qwen工程团队在部署llama-server时遇到的参数失效问题:明明设置了-c 32768上下文参数,却仍报错"超出4096 tokens限制"。经排查发现,问题根源是批处理脚本中续行符^后存在两个空格,导致参数被忽略。文章详细解析了Windows批处理中^的严格语法规则(必须紧贴前字符),对比了错误与正确写法的差异,并给出4条实用建议:使用编辑器显示空白字符、调试时关闭@echo off、预检完整命令、优先单行命令。最后强调在AI系统部署中,此类"隐 阅读详情

相关推荐

ICT调试技巧:从基础到实战的全面指南

本文提供了一份全面的ICT调试技巧指南,涵盖从基础认知到实战应用的全过程。详细解析了ICT设备硬件结构、程序文件构成,并重点讲解了调试界面的核心参数与高效快捷键。通过跳线、电阻、电容及二极管等常见元器件的实战调试案例,分享了参数设置要点与典型问题解决方案,帮助工程师快速掌握ICT调试核心技能,提升测试效率与准确性。

weixin_29202213的博客 342

flash 小游戏大全

http://www.xiaoyouxi.com/http://www.4399.com/http://yule.sohu.com/flashgame.shtml   Flash游戏-最新FLASH-极酷动漫-搜狐娱乐

xubaogongChina的专栏 2万+

Unity坦克物理系统:履带驱动与力场建模实战指南

在游戏物理仿真中,履带车辆的运动建模远超传统轮式控制器的范畴。其核心在于摒弃WheelCollider的滚动幻觉,转向基于牛顿力学的力与力矩协同求解——通过主推进力场、转向力矩场和地面反作用力场三重叠加,实现对质量、摩擦、惯性及坡度阻力的真实响应。这种建模方式不仅支撑坦克爬坡、陷泥、侧倾等复杂行为,更保障了多人同步与高帧率下的物理稳定性。Physics Tank Maker 正是这一思路的工业级落地,它将PhysX底层机制与坦克动力学深度耦合,提供可调参数、事件驱动视觉反馈及标准扩展接口,成为面向严肃模拟类

weixin_29535577的博客 562

FZU 2148 Moon Game

Description Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as a kind of two-dimensional plane. Then Fat brother starts to draw N

fuckohmylove的专栏 7714

MAX30102心率血氧传感器:从原理到实践的可穿戴健康监测方案

本文深入解析MAX30102心率血氧传感器的工作原理及在可穿戴健康监测中的实践应用。通过反射式光电容积脉搏波(PPG)技术,该传感器能精准测量心率和血氧饱和度,具备低功耗、高抗干扰等优势。文章详细介绍了信号处理算法、硬件连接技巧及创新应用场景,为开发者提供全面的解决方案。

weixin_29184371的博客 282

开源网格划分软件-Gmsh二次开发教程 (4)网格生成与控制​

​本章将深入讲解Gmsh的网格生成技术,包括全局/局部网格控制、边界层生成、自适应细化等,并提供完整的代码示例。

ZQGG的博客 1472

FZU 2264 Card Game (First Edition)(数学概率题)

Problem 2264 Card Game (First Edition) Accept: 114    Submit: 343 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (

qq_37164003的博客 623

eDP V1.4协议介绍

eDP的全称是Embedded DisplayPort嵌入式显示端口,主要应用与短距离系统内应用,例如手机、一体式台式机等。eDP V1.4b是基于DP V1.3标准制作完成,但因应用场景的不同,还是有很多区别。电压摆幅不同,eDP相对较低;eDP功耗相对较低;DP有线材和连接器的要求,eDP没有明确要求;AUX通道电路设计不同(相对DP取消了AC耦合电容和100KΩ/1MΩ的上下拉电阻):典型应用场景;

qflook的博客 4301

史上最强3DGALGAME らぶデス 3 Realtime Lovers 3 海茶3 简介

接天使哥哥的委托(斑竹) 给大家介绍史上最强3DGALGAMEらぶデス3 性感海茶3( 这个骇人听闻的标题是百度上的,不是 史上最强的也请不要说我小白 )资料汉化人员策划:天使哥哥(beautyfishno1 )图片资料:翻译benneyfan润色&修图:大师♂罗莊(luozhuang)本文文字:大师♂罗莊(luozhuang)转载请完整转载并注明出

大师的资源 9万+

整车电检工艺流程

本文是笔者在从事汽车行业智能制造领域过程,对于整车电检工艺流程的理解与总结。

qq_40664711的博客 1万+

使用HART Server PC软件进行HART设备的组态、调试和分析的完整指南

HART协议是一种用于工业自动化中的双向通信协议,能够在4-20mA模拟信号的基础上叠加数字信号,从而实现设备的远程监控和管理。HART协议兼具模拟和数字通信的优点,被广泛应用于过程控制系统中。设备组态:通过软件可以对HART设备进行组态,配置设备参数。设备调试:支持设备的在线调试和故障诊断,方便快速解决问题。数据分析:提供设备运行数据的实时监控和历史数据分析功能。报表生成:支持生成各类报表,便于数据记录和管理。

qq_38334677的博客 2468

A-B Game 水题+longlong

题目来源:http://acm.fzu.edu.cn/contest/problem.php?cid=134&sortid=8 Problem H A-B Game Accept: 103Submit: 237Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description Fat...

weixin_33816821的博客 278

Motoman机器人离线编程——Motocom32开发简介

欢迎关注Jungle的Motoman机器人离线编程专栏系列文章: Motoman机器人离线编程——Motocom32开发简介 Motoman机器人离线编程——Visio Studio环境配置 Motoman机器人离线编程——Motocom32库函数的使用与封装 Motoman机器人离线编程——Motocom32参考文献及注意事项 Motoman机器人离线编程——MotocomES介绍 ...

冯Jungle的个人博客 8713

FZU 2265 Card Game (Second Edition)

http://acm.fzu.edu.cn/problem.php?pid=2265#include&lt;iostream&gt; #include&lt;algorithm&gt; #include&lt;cstring&gt; #include&lt;cstdio&gt; using namespace std; int main() { int T; int n; int cmp=0...

三水的鱼塘♂ 310

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

B - Card Game (Second Edition) FZU - 2265

Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck. The game goes for N rounds and in

这里是假的博客 370

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

FZU - 2265 Card Game (Second Edition)

/* 看来我思维方面还是...可能做题太少,还没建立题感,别人能想到想明白的,我却很难才能相通 就题论题...这题的关键是,胖兄弟有n张牌,也就有n种出牌的可能,把这n种情况下,可能得到的点数总和求出来,再除n得期望 点数总和怎么算? 把maze的所有牌排个序,比当前胖兄弟抽出的牌的点数要少的情况,就是胖兄弟出该牌得到的点数 以及,n种情况,都是独立考虑的,(

怕什么真理无穷?进一寸有一寸的欢喜~ 397

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

FZU - 2265-Card Game (Second Edition)-期望

题意:A和B进行n轮的比赛,A拥有N张牌,B拥有N张牌.A,B任意出牌,谁出的牌大则谁得一分.现在要求出A获得分的期望.题解:期望为平均值,期望具有累加性!而每一轮相当是一局独立重复事件.对于每一轮来说,A[i]能得分的期望是 Ei = 1*ti / n + 0 * (n-ti) / n这里的ti 是 对于A[i] 来说其能打败B[i]中的牌的个数于是对于每一个A[i]来说,我们可以用二分计算出在...

Uniontake 268

FZU2265 Card Game (Second Edition)(数论&规律)

Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck. The game goes for N rounds and in ...

UncleJokerly 561

Card Game (First Edition) FZU - 2264 Card Game (Second Edition) FZU - 2265 (数学期望)

Fat brother and Maze are playing a kind of special (hentai) game with some cards. There are N*2 cards in this game for the players to use, this is the card deck. The game goes for N rounds and in each...

obsorb_knowledge的博客 1331

fzu2265Card Game (Second Edition) (数学)(简单)

b 从小到大排序, a对应有n!中排列,其中a[i]对于某个b[j]是有(n-1)!都是对应的(因为a[i]只能对应n个b中),而a[i]对应b[j]的值是一定的,可以直接计算出每个a[i]在这n!中方案中的贡献值,所有a[i]然后相加除以n!(可以把n-1!去掉,最后就是除以n了)。   就是说每个a[i]都会有n*(n-1)!种对应情况,然后只要算出n种情况里面哪几个贡献出了1分,最后

mosquito_zm的博客 571

2265 Card Game (Second Edition)

Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck. The game goes for N rounds and in each round, Fat Brother and Maze would draw one card fro

haha的博客 678

FZUOJ 2265 Card Game (Second Edition)

题目链接:http://acm.fzu.edu.cn/problem.php?pid=2265 第七届福建省赛重现赛D题,概率计算不过挺有技巧的,问了acdart兄才恍然大悟(分明看了好长时间。。。) acdart原话: b从小到大排序,a对应有n!中排列,其中a[i]对于某个b[j]是有(n-1)!都是对应的(因为a[i]只能对应n个b中),而a[i]对应b[j]的值是一定...

weixin_30646505的博客 153

Fire Game

Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...

王子原的博客 2968

FZU_Problem 2151 OOXX Game

Problem 2151 OOXX Game Accept: 476    Submit: 730 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai) game on

有一种力量叫乐观 1680

fzu-2266

C - Card Game (Third Edition)   Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck

yu121380的博客 487

OOXX Game

Think: 这次组队赛的水题。。。。 判断 O 是奇数还是偶数 然后对应输出就可以了~~~Problem DescriptionFat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, there are N

不积跬步,无以至千里 1万+
上一篇: Card Game (First Edition) FZU - 2264
下一篇: Card Game (Third Edition) FZU - 2266
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值