HDU-1029 java

Windows本地部署Qwen3-14B实战指南:Ollama+Open WebUI零Docker方案 大语言模型本地部署是AI工程化落地的关键环节,其核心在于推理框架兼容性、硬件加速适配性与端到端稳定性。Ollama作为轻量级模型运行时,原生支持Windows DirectML与CUDA,规避了Docker/WSL2虚拟化开销和llama.cpp编译风险;Qwen3-14B则凭借128K上下文、Tool Calling原生支持及中文长文本结构化能力,成为政务、金融等场景首选。本文聚焦Windows平台真实约束——显存阈值、驱动版本匹配、路径编码兼容、离线知识库集成(RAG)等工程细节,提供经63台Windo 阅读详情

Ignatius and the Princess IV

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others)
Total Submission(s): 39731    Accepted Submission(s): 17315


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 them, you have to tell me which integer is the special one after I tell you all the integers." feng5166 says.

"But what is the characteristic of the special integer?" Ignatius asks.

"The integer will appear at least (N+1)/2 times. If you can't find the right integer, I will kill the Princess, and you will be my dinner, too. Hahahaha....." feng5166 says.

Can you find the special integer for Ignatius?
 

Input
The input contains several test cases. Each test case contains two lines. The first line consists of an odd integer N(1<=N<=999999) which indicate the number of the integers feng5166 will tell our hero. The second line contains the N integers. The input is terminated by the end of file.
 

Output
For each test case, you have to output only one line which contains the special number you have found.
 

Sample Input
51 3 2 3 3111 1 1 1 1 5 5 5 5 5 571 1 1 1 1 1 1
 
Sample Output

351


此题java貌似过不了(说不定那种BufferedReader的读取方法可以过???没试过),下面贴上复杂度n的摩尔投票代码

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
     Scanner cin=new Scanner(System.in);
     while(cin.hasNext())
     {
    	 int N=cin.nextInt();
    	 int x;
    	 int maxnum=-1;
    	 int count=0;
    	 for(int i=0;i<N;i++)
    	 {
    		 x=cin.nextInt();
    		 if(count==0)
    		 {
    			 maxnum=x;
    			 count=1;
    		 }
    		 else if(maxnum==x)
    		 {
    			 count++;
    		 }
    		 else count--;	 
    	 }
    	 System.out.println(maxnum);
    	 
     }
	}

}
摩尔投票,赠送网址一个http://mabusyao.iteye.com/blog/2223195
------------------------------------------------------------------------------------------
今天闲着没事,试了试BufferedReader,又参考了别人写的别的题目的用法,没想到真的过了
贴上代码:
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) {
       try{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
     
		while(true)
     {
    	 
    	 String s=br.readLine();
    	 if(s.equals(""))continue;
    	 
    	 int N=Integer.parseInt(s.trim());
    	 int x;
    	 int maxnum=-1;
    	 int count=0;
    	 String str=br.readLine().trim();
		 String strings[]=str.split(" ");
    	 for(int i=0;i<N;i++)
    	 {
             x=Integer.parseInt(strings[i]);
    		 if(count==0)
    		 {
    			 maxnum=x;
    			 count=1;
    		 }
    		 else if(maxnum==x)
    		 {
    			 count++;
    		 }
    		 else count--;	 
    	 }
    	 System.out.println(maxnum);
    	 
     }
       }catch(Exception e){
    	   
       }
	}

}


智能家居DIY:用51单片机实现三合一环境监测(温湿度+烟雾+自动灭火) 本文详细介绍了如何利用STC89C52单片机打造智能家居三合一环境监测系统,集成温湿度检测、烟雾报警和自动灭火功能。从硬件选型、电路设计到软件编程,提供完整的DIY方案,帮助读者构建高性价比的家庭安全防护系统,特别适合智能家居爱好者和电子DIY初学者。 阅读详情

相关推荐

等保: Postgresql配置ssl链接

等保: postgresql配置ssl链接完整方案和避坑指南

weixin_43557605的博客 4387

hdu 1029

hdu 1029

Bleach_kids的专栏 463

导数在工程与AI中的12个实战应用解析

导数作为数学中的基本概念,本质是描述变化率的工具,其核心价值在于将非线性问题局部线性化处理。从原理上看,通过极限过程捕捉函数瞬时变化特性,使工程师能精确控制系统动态行为,帮助科学家量化自然规律变化速率。在技术实现层面,现代符号计算(如Mathematica)、数值计算(如MATLAB)和自动微分(如PyTorch)工具链的发展,大幅提升了导数计算的效率与精度。典型应用场景涵盖机械控制(如ABS防抱死系统)、金融工程(如期权希腊值计算)、医疗影像(如Canny边缘检测)等领域。特别在机器学习中,反向传播算法依

weixin_35509395的博客 329

Ignatius and the Princess IV

"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 ...

ujn20161222的博客 226

newman的使用

Newman是一个基于Node.js的postman命令行工具,用于运行和测试PostmanAPI 请求的集合。它允许用户在命令行环境中执行Postman的JSON文件,从而实现接口自动化测试和持续集成,同时支持用户进行自动化测试、批量执行请求、生成报告等操作。

m0_62825058的博客 1625

手把手教你用TiggerRamDisk绕过iPhone/iPad激活锁(支持iOS16.3,Win/Mac双平台保姆级教程)

本文详细介绍了如何使用TiggerRamDisk工具绕过iPhone/iPad的激活锁,支持iOS16.3系统,并提供Windows和Mac双平台的保姆级教程。从工具准备、设备连接到核心解锁流程,一步步指导用户完成操作,帮助二手设备或旧设备重获新生。

weixin_29323493的博客 1013

hdoj1029

Ignatius and the Princess IVTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others)Total Submission(s): 5220    Accepted Submission(s): 1684Problem Description"OK, you are not too bad, em... But you can never pass the next test.

独行闹市无人问,青灯剑影响素琴 780

【毕业设计】_基于STM32单片机的按摩椅( 原理图+源码)

按摩器系统基于STM32单片机设计,作为核心控制单元。系统配备了OLED显示屏、蓝牙模块、喇叭模块、播报模块和光电感应模块。光电感应器用于检测是否有人接近,同时,系统可以通过蓝牙接收控制指令并执行相应的操作。该系统支持40℃的热敷功能以及气囊按摩功能,具备温度显示功能,并且可以通过按键切换不同的按摩模式。当光电感应器检测到有人时,按摩椅会自动启动。使用DHT11传感器的红色按钮可以调整温度。

2401_85381100的博客 730

HDOJ 2090

Problem Description 妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐。现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵。     Input 输入含有一些数据组,每组数据包括菜种(字串),数量(计量单位不论,一律为double型数)和单价(double型数,表示人民币元数),因此,每组数据的菜价就是数量乘上单价啊。菜种、...

weixin_34008784的博客 1225

【华为OD】华为性格测试(综合测试)高分策略

1、性格测试非常重要,是一次否决制,18 个月有效期,所以态度一定要认真对待,不要随便乱选;2、做题原则:正向原则,积极乐观向上3、时间为 25-30 分钟,会频繁出现重复选项重复出现的题目注意一致性。

笑着的程序员的博客 3万+

【华为OD机试真题】2、在字符串中找出连续最长的数字串含+-号 | 机试真题+思路参考+代码解析(C++、Java、Py)

题目描述 >请在一个字符串中找出连续最长的数字串,并返回这个数字串。 如果存在长度相同的连续数字串,返回最后一个。 如果没有符合条件的字符串,返回空字符串””。   注意: 数字串可以由数字”0-9″、小数点”.”、正负号”±”组成,长度包括组成数字串的所有符号。 “.”、“±”仅能出现一次,”.”的两边必须是数字,”±”仅能出现在开头且其后必须要有数字。 长度不定,可能含有空格

KJ.JK 6286

HDU-1029-Ignatius and the Princess IV(dp)

                                 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 num...

1374

RK3588部署实战:利用RGA硬件加速单元优化YOLOv5的图像预处理与推理性能

摘要:本文探讨了在Rockchip芯片上使用RGA(Rockchip图形加速器)实现YOLOv5图像预处理的过程。通过对比RGA和OpenCV两种方式处理图像的速度,发现RGA加速效果不明显且不稳定(13-17fps),分析原因可能是图片尺寸过小和内存操作消耗时间。文章详细介绍了RGA版本的resize和letterbox实现代码,包括图像缩放、边缘填充等功能,并提供了预处理流程和性能监控方法。结果表明在当前场景下RGA尚未达到预期加速效果,可能与官方代码下架和实现细节有关。

know_F0727的博客 300

HDU1029java版本

Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32767 K (Java/Others) Total Submission(s): 30701 Accepted Submission(s): 13105Problem Description “OK, y

周孟齐的博客 338

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

HDOJ1029 Ignatius and the Princess IV

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029 这个题目有个坑的地方就是,java难以AC。 使用快排或者统计都超时了,但是同样的方法使用C语言就过了。 题意是给你n个数(n是奇数),将出现次数大于(n+1)/2的数输出。 这样的数显然就只有一个的,可以使用统计的方式。 #include #include in

BarryLee的博客 363

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

HDU - 1029 Ignatius and the Princess IV (Java - map)

Ignatius and the Princess IV 借此机会,学习了一下java中的map类 import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner cin = new Sc...

辞树 202

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Java快速输入输出

需要的头文件有 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; 在主...

Change the world by program. 2684

hdu-1029 Ignatius and the Princess IV

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): 28646    Accepted S

oYinGui1 1336

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): 40942    Accepted Submission(s): 17900Problem Description "OK, you a...

Emiya丶的博客 252

[HDU - 1029] Ignatius and the Princess IV(动态规划)

Link:http://acm.hdu.edu.cn/showproblem.php?pid=1029Problem 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 i

Hello Joanna 326

HDU1029

import java.util.Map.Entry; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String args[]) {

Loser_LOSERdyh的博客 141

HDU 1029 Ignatius and the Princess IV (简单DP)

hdu 1029 题目: Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others) Total Submission(s): 42940    Accepted Submission(s): 18774   Problem ...

Kruskal的博客 403

HDU1029 Ignatius and the Princess IV(数组中出现次数最多的数)

题目:HDU1029 Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32767 K (Java/Others) Total Submission(s): 44112Accepted Submission(s): 19470 Problem De...

CarreLiu 198

HDU1029 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): 37147    Accepted Submission(s): 16227 Problem Description

海岛Blog 2308

大数计算方法

大数计算三种方法: 一.c/c++模拟法   二.c/c++万进制/亿进制法 1.UVA495 Fibonacci Freeze【大数 万进制】   三.采用Java/Python来写(代码简洁,强烈推荐) 1.51NOD-1027 大数乘法【大数 Python、Java】 2.51NOD-1028 大数乘法V2【大数 Python、Java】 3.51NOD-1029 大数除法...

fyy_lufan的博客 4249

HDU 1029

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

yane的博客 360
上一篇: HDU-1024 java 实现
下一篇: HDU-1069-java实现
SoulGuide
博客等级 码龄9年 9粉丝 14原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值