HDU 1029 Ignatius and the Princess IV 水题

【国产MCU】-认识CH32V307及开发环境搭建 CH32V307是[沁恒](https://www.wch.cn/)推出的一款基于32位RISC-V设计的互联型微控制器,配备了硬件堆栈区、快速中断入口,在标准RISC-V基础上大大提高了中断响应速度。加入单精度浮点指令集,扩充堆栈区,具有更高的运算性能。扩展串口UART数量到8组,电机定时器到4组。提供USB2.0高速接口(480Mbps)并内置了PHY收发器,以太网MAC升级到千兆并集成了10M-PHY模块。 阅读详情
思路:排序后的 a[(n+1)/2] 即是答案。

http://acm.hdu.edu.cn/showproblem.php?pid=1029

/*********************************************
    Problem : HDU 1029
    Author  : NMfloat
    InkTime (c) NM . All Rights Reserved .
********************************************/

#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

#define rep(i,a,b)  for(int i = a ; i <= b ; i ++)
#define rrep(i,a,b) for(int i = b ; i >= a ; i --)
#define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next)
#define cls(a,x)   memset(a,x,sizeof(a))
#define eps 1e-8

using namespace std;

const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e6+5;
const int MAXE = 2e5+5;

typedef long long LL;
typedef unsigned long long ULL;

int T,n,m,k;

int A[MAXN];

void input() {
    rep(i,1,n) scanf("%d",&A[i]);
}

void solve() {
    sort(A+1,A+n+1);
    printf("%d\n",A[(n+1)/2]);
}

int main(void) {
    //freopen("a.in","r",stdin);
    //scanf("%d",&T); while(T--) {
    //while(~scanf("%d %d",&n,&m)) {
    while(~scanf("%d",&n)) {
        input();
        solve();
    }
    return 0;
}
麒麟操作系统提示“默认密钥环已上锁”的解决办法 阅读详情

相关推荐

【鸿蒙实战开发】HarmonyOS申请调试签名证书过程

这份鸿蒙(HarmonyOS NEXT)资料包含了鸿蒙开发必掌握的核心知识要点,内容包含了(ArkTS、ArkUI开发组件、Stage模型、多端部署、分布式应用开发、音频、视频、WebGL、OpenHarmony多媒体技术、Napi组件、OpenHarmony内核、Harmony南向开发、鸿蒙项目实战等等)鸿蒙(HarmonyOS NEXT)技术知识点。

HarmonyOS_002的博客 3561

hdu1029 Ignatius and the Princess IV 水题

Ignatius and the Princess IV Time Limit: 1000MS   Memory Limit: 32767KB   64bit IO Format: %I64d & %I64u Submit Status Description "OK, you are not too bad, em... But y

kyoma的博客 505

从选型到调试:MCU外部晶振电路设计的实战避坑指南

本文详细解析了MCU外部晶振电路设计的关键要点,从选型到调试提供全面指南。重点探讨了晶振频率选择、负载电容计算、PCB布局优化等核心问题,并分享常见故障排查技巧与EMC设计经验,帮助工程师规避设计陷阱,提升嵌入式系统时钟稳定性。

weixin_30872577的博客 276

hdu1029 Ignatius and the Princess IV sort水题

Ignatius and the Princess IVTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others)Total Submission(s): 40689    Accepted Submission(s): 17763Problem Description"OK, you ar...

popcjz的博客 178

瑞芯微rv1126 rtsp+mpp+rga取流

瑞芯微rv1109 rtsp+mpp+rga取流

ZuoSeDiao的博客 6338

IEEE PHM 2012轴承数据实战:用LSTM预测剩余寿命的完整流程与调参心得

本文详细解析了如何利用IEEE PHM 2012轴承数据集和LSTM模型进行轴承剩余寿命预测。从数据预处理、特征工程到LSTM模型架构设计和调参技巧,提供了完整的实战流程。特别分享了FEMTO-ST数据集的处理方法、RUL标签构建策略以及提升预测精度的关键技巧,帮助工程师实现更准确的预测性维护。

weixin_31100517的博客 368

HDU 1029 Ignatius and the Princess IV (DP,水题)

Ignatius and the Princess IVTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32767 K (Java/Others) Total Submission(s): 34042 Accepted Submission(s): 14804题目链接Problem Description “OK,

南风古 426

【爬虫】Python实现爬取淘宝商品信息(超详细)

项目基于Python的第三方库Selenium模拟浏览器运行、PyQuery解析和操作HTML文档,获取淘宝平台中某类商品的详细信息(商品标题、价格、销量、商铺名称、地区、商品详情页链接、商铺链接等),并基于第三方库openpyxl建立、存储于Excel表格中。# 全局变量count = 1 # 写入Excel商品计数# 启动ChromeDriver服务# 关闭自动测试状态显示 // 会导致浏览器报:请停用开发者模式# 把chrome设为selenium驱动的浏览器代理;# 窗口最大化。

qq_46315152的博客 4万+

HDU 1029 Ignatius and the Princess IV(水题)

Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others) Total Submission(s): 34165    Accepted Submission(s): 14876 Problem Descriptio

爱喝特仑苏 226

Python 爬虫教程:财经新闻实时抓取(最新资讯 + 关键词提取)

在当今信息爆炸的时代,财经新闻的实时获取对于投资者、研究人员以及普通大众来说都具有重要的价值。通过 Python 爬虫技术,我们可以高效地抓取财经新闻,并提取其中的关键信息,以便更好地进行数据分析和决策支持。本文将详细介绍如何使用 Python 编写一个财经新闻实时抓取系统,并结合关键词提取技术,帮助读者快速掌握 Python 爬虫的核心技能。

yansideyucsdn的博客 1049

【嵌入式DIY实例ESP32篇】-步数计数器

在本项目中,我们将使用 ESP32 微控制器和博世的 BMI160 加速度计陀螺仪模块构建一款便携式计步器

视觉与物联智能 803

HDU 1029 Ignatius and the Princess IV(水题亦有妙法)

题目链接:[kuangbin带你飞]专题十二 基础DP1 B - Ignatius and the Princess IV题意 给n(奇数)个数,定义特殊的数为在序列中出现次数不少于(n+1)/2次的数,找出这个特殊的数 思路 我ac的思路是直接排序,然后一次循环进行对出现次数最大值的判断。 还有一种方法是排序后找第n/2大的数,因为特殊数出现次数超过一半,所以排序后中位数一定是特

YiShi's Blog 2656

【nerfStudio】1-在windows上安装nerfStudio

安装Git。安装Visual Studio 2022。在安装CUDA之前必须完成此步骤。必须在“桌面开发与C++”工作流程(在BuildTools版本中称为“C++构建工具”)中包含所需的组件。Nerfstudio要求。我们建议使用conda来管理依赖关系。在继续之前,请确保安装了Conda。 依赖关系 PyTorch 请注意,如果安装了低于2.0.1的PyTorch版本,则应卸载先前版本的pytorch、functorch和tiny-cuda-nn。 基于CUDA 11.8的Torch 2.0.1 安装基

dlhlSC的博客 1692

HDU1029 - Ignatius and the Princess IV【水题】

给你n个数字,请你找出出现至少(n+1)/2次的数字。 输入 本题包含多组数据,请处理到EOF: 每组数据包含两行。 第一行一个数字N(1&lt;=N&lt;=999999) ,保证N为奇数。 第二行为N个用空格隔开的整数。 输出 对于每组数据,输出一行,表示要求找到的那个数 样例输入 5 1 3 2 3 3 11 1 1 1 1 1 5 5 5 5 5 5 7 1 1 1...

独钓门前月 536

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Ignatius and the Princess IV HDU - 1029 (水题,依然很详细!!!!)

"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. "I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to t...

qq_43813697的博客 214

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

HDU 1029 Ignatius and the Princess IV --- 水题

  HDU 1029   题目大意:给定数字n(n <= 999999 且n为奇数 )以及n个数,找出至少出现(n+1)/2次的数   解题思路:n个数遍历过去,可以用一个map(也可以用数组)记录每个数出现的次数,        若次数一旦达到(n+1)/2,即输出a[i]        注意能出现(n+1)/2次数的最多只有一个 /* HDU 1029 *Igna...

weixin_30834783的博客 112

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

hdu 1029 Ignatius and the Princess IV(水题)

Ignatius and the Princess IVProblem Description“OK, you are not too bad, em… But you can never pass the next test.” feng5166 says.“I will tell you an odd number N, and then N integers. There will be a

Darkarts 571

【HDU - 1029】Ignatius and the Princess IV (水题)

Ignatius and the Princess IV 先搬中文 Descriptions: 给你n个数字,你需要找出出现至少(n+1)/2次的数字 现在需要你找出这个数字是多少? Input本题包含多组数据,请处理到EOF: 每组数据包含两行。 第一行一个数字N(1<=N<=999999) ,保证N为奇数。 第二行为N个用空格隔开的整数。 Output 对于每组数据,输出一...

Sky丨Star的博客 103

HDU——1029 Ignatius and the Princess IV(水题 降低时间复杂度)

Problem Description “OK, you are not too bad, em… But you can never pass the next test.” feng5166 says. “I will tell you an odd number N, and then N integers. There will be a special integer among t...

LightOn 320

HDU 1029 Ignatius and the Princess IV 水题排序

这一系列名字终于做到最后一个了,本以为最后压轴会是一道难题,好吧,读完题发现只是一道水题而已......题意是说给一排数字,求出其中最多的数字是哪一个,而且这一排数字个数是奇数,那个最多的数比这一排数的个数的一半还多......读到这基本也明白了= =既然是比一半还多还是奇数,把所有数一排,中位数就是要求的这个数了......一个sort就这样水过了~ #include #include #in

富士山下 275

hdu 1029 Ignatius and the Princess IV 每日水题

#include<stdio.h>#include<string.h>#include<map>#include<iostream>using namespace std;int main(){ int n,k; map<int,int>m; while(scanf("%d",&n)!=EOF) { ...

weixin_34388207的博客 72

hdu 1029 Ignatius and the Princess IV(水题,map)

小记:细节决定成败。 思路:题目没说给定的数可能

ljd4305的专栏 760

HDU 1029 Ignatius and the Princess IV(水题)

题意:给N个数,输出这N个数中出现至少(N+1)/2次的数.#include using namespace std; __int64 num[1000000];//感觉可以开得更小点。数据挺弱的 int main() { int n; while(~scanf("%d", &n)) { int k=(n+1)/2,x, ans; while(n--) { scanf("%

WinForBest 440

HDU1029 Ignatius and the Princess IV (水题)

<题目链接> 题目大意:给你一段序列,问你在这个序列中出现次数至少为 (n+1)/2 的数是哪个。 解题分析: 本题是一道水题,如果用map来做的话,就非常简单,但是另一个做法还比较巧妙。 解法一: #include <cstdio> int main() { int n,t,cnt,result; while(scanf("%d",&...

weixin_30348519的博客 99

A - Ignatius and the Princess IV HDU - 1029(水题)

“OK, you are not too bad, em… But you can never pass the next test.” feng5166 says. “I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to tell ...

qq_40604099的博客 332
上一篇: HDU 1173 采矿 计算几何
下一篇: HDU 1026 Ignatius and the Princess I BFS
_NMfloat_
博客等级 码龄12年 7粉丝 315原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值