zoj 1037

STM32单片机:驱动ADS1115四个通道全开程序 本文介绍了德州仪器(TI)的ADS1115高精度16位模数转换器(ADC)及其应用实现。该芯片具有16位分辨率、可编程增益放大器(PGA)和低功耗特性,支持±0.256V至±6.144V量程。文章提供了完整的C语言驱动代码,包括初始化、配置寄存器读写、单次/连续转换模式设置、电压值读取等功能实现。代码通过I2C接口与ADS1115通信,支持多通道选择和不同PGA设置,可实现高精度模拟信号采集。该方案适用于需要精密测量的嵌入式系统,如传感器数据采集等应用场景。 阅读详情

Gridland

Background

For years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available, these are the "easy" problems like sorting, evaluating a polynomial or finding the shortest path in a graph. For the "hard" ones only exponential-time algorithms are known. The traveling-salesman problem belongs to this latter group. Given a set of N towns and roads between these towns, the problem is to compute the shortest path allowing a salesman to visit each of the towns once and only once and return to the starting point.

Problem

The president of Gridland has hired you to design a program that calculates the length of the shortest traveling-salesman tour for the towns in the country. In Gridland, there is one town at each of the points of a rectangular grid. Roads run from every town in the directions North, Northwest, West, Southwest, South, Southeast, East, and Northeast, provided that there is a neighbouring town in that direction. The distance between neighbouring towns in directions North-South or East-West is 1 unit. The length of the roads is measured by the Euclidean distance. For example, Figure 7 shows 2 * 3-Gridland, i.e., a rectangular grid of dimensions 2 by 3. In 2 * 3-Gridland, the shortest tour has length 6.

 
Figure 7: A traveling-salesman tour in 2 * 3-Gridland.

Input

The first line contains the number of scenarios.

For each scenario, the grid dimensions m and n will be given as two integer numbers in a single line, separated by a single blank, satisfying 1 < m < 50 and 1 < n < 50.


Output

The output for each scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. In the next line, print the length of the shortest traveling-salesman tour rounded to two decimal digits. The output for every scenario ends with a blank line.


Sample Input

2
2 2
2 3


Sample Output

Scenario #1:
4.00

Scenario #2:
6.00 



代码:

#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,i=1;
	int n;
	scanf("%d",&n);
	while(i<=n)
	{
		scanf("%d%d",&a,&b);
		printf("Scenario #%d:\n",i++);
		if(a%2!=0&&b%2!=0)
		{
			printf("%0.2f\n\n",(float)a*b-1+sqrt(2.0));
				
		}
		else
		{
			printf("%0.2f\n\n",(float)a*b);
			
		}

		
	}

	return 0;

}

PD3.0详解 第十一章 策略层 电源协商(三)(sink端) 前面大师匈介绍了Source端的内容,今天再看一下sink端的内容。大师匈还是想把标准文件的状态机拿出来说一下。大师匈把一张图分成俩部分,大家凑合看一下,一张图实在看不清内容。 Sink 端电源协商状态机。基于sink端哦!!! 上图先!!! 上面俩张图就是整个SINK端口的状态机了。。。介绍一下这个流程: 1、收到hardreset或者刚上电的进入PE_SNK_Startup开始状态。 2、在PE_SNK_Startup阶段后进入PE_SNK_Discovery,并等待Vbus的到来。 3、当Vbus 阅读详情

相关推荐

SIwave仿真手册——软件基础(一)

最近在学习SIWAVE,在这里将自己的笔记整理一下,做一个专题。希望对大家有帮助,这个会持续更新的。仅限于软件操作学习,不涉及信号完整性的讨论。

luohuo9844的博客 4万+

Security Onboard Communication-SecOC

一、通讯加密的必要性 随着汽车电子的发展及整车功能复杂性的提高,车载控制器数量从之前的寥寥几个增加至规模复杂的上百个。基于功能的需求,各个控制器每时每刻需要进行大量数据的交互,数据交互的方式也多种多样,比如Lin、CAN、CANFD、FlexRay 、车载Ethernet等。 其中成本低、可靠性高、应用普遍的有Lin、CAN通讯,而FlexRay、车载Ethernet等基于成本因素,目前主...

toywang123的博客 4192

知识图谱与人工智能本体论:构建机器认知的语义基石

本文探讨了知识图谱与人工智能本体论如何作为机器认知的语义基石,让AI从‘知道数据’迈向‘理解知识’。文章详细拆解了本体论的核心构件与构建方法,并阐述了从本体到知识图谱的实践路径,包括知识获取、融合、存储及推理应用,最终分析了其在智能搜索与专家系统等场景中带来的根本性重塑。

nginx7reverse的博客 917

杭电acm1046 Gridland

杭电acm1046                                             Gridland Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2113    Accepted Submission(s

怪凯的专栏 1436

告别轮询!用STM32CubeMX给STM32F030配置ADC多通道+DMA,实测代码分享

本文详细介绍了如何使用STM32CubeMX为STM32F030配置ADC多通道采集与DMA传输,显著提升采集效率。通过实测对比轮询与DMA模式的性能差异,提供完整的代码实现和优化技巧,帮助开发者快速掌握这一高效采集方案。

weixin_42570296的博客 420

KiCad 7.0 + 嘉立创打样:从原理图到实物,打造你的双LLCC68 LoRa串口透传板

本文详细介绍了使用KiCad 7.0设计双LLCC68 LoRa串口透传板的完整流程,从原理图设计到嘉立创打样。重点解析了AVR+LLCC68组合的优势、双模块布局的电磁兼容设计、SPI接口配置及射频走线技巧,并提供了实测数据和常见问题解决方案,帮助开发者高效实现物联网设备的低功耗远距离通信。

weixin_28693447的博客 266

1.21 英语翻译打卡

链接:Gridland | JXNUOJ 描述: For years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available, these are the “easy” problems like sorting, evaluating a po

m0_63365528的博客 345

World Creator地形导入UE

导出预设选择高度图(heigh map)格式选择PNG 16位,或者RAW 16位,需要反转y轴(与虚幻不同),命名格式会自动带一个× , 将×改成_ 或者删掉自己命名 (虚幻名称不支持x符号)导入虚幻 , 修改Z轴 , 就是用 地形最高 - 地形最低 , 然后除以512 , 再乘以100。把这个数字填入Z轴缩放 , 点击生成即可。

UE星空 2168

2021-09-30每日刷题打卡

一、ZOJ-1037:Gridland 1.1 问题描述 Background For years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available, these are the “easy” problems like sorting, ev

soulandlove的博客 438

辛普森悖论:识别数据聚合偏误与混杂变量的实战指南

辛普森悖论是一种典型的聚合偏误现象,源于未控制的混杂变量导致分组分配不均,使整体统计结果与各子群真实效应方向相反。其本质不是数据错误,而是因果推断框架在忽略结构异质性时的失效。该悖论在医疗临床试验、AB测试、商业归因等高频场景中隐蔽性强、触发门槛低,常造成决策反转。掌握分层分析方法、Cochran-Mantel-Haenszel检验及双Y轴可视化技术,可有效识别并破解误导性汇总结论。本文聚焦辛普森悖论与数据误导两大核心问题,提供从诊断、验证到汇报的全流程工程化应对方案。

weixin_28520495的博客 515

电脑技巧:Hyper-V安装UOS操作系统图文教程

今天给大家分享微软官方Hyper-v虚拟机管理软件安装UOS操作系统图文教程,感兴趣的朋友也可以下载试一试,当然有啥问题也可以互相沟通交流!

IT技术分享社区 4710

Gridland (初试ACM)

Background For years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them efficient algorithms are already available, these are the "e

KelvinWu的专栏 866

Unreal5.6从入门到精通之 如何实现MetaHuman数字人

本文介绍了使用HYPER3D-ChatAvatar网站生成3D头部模型,并导入Unreal Engine制作数字人的完整流程。首先上传照片生成头部模型(约2分钟),设置参数后下载模型文件。然后在UE5.6中创建项目,激活MetaHuman插件,导入头部模型并调整肤色、面部特征和身体模板。通过MetaHuman Creator组装数字人蓝图,支持添加音频/视频动画功能。关键步骤包括:取消Rigging选项节省时间、切换英文模式避免材质问题、使用Live Link Face应用实现面部捕捉等。整个流程约需5-1

TxNet 1366

ZOJ 1037

<br />同学说从beginner problems开始做,我想也是,慢慢积累更好。<br />所以今天做了ZOJ 1037<br /> <br />原来是个找规律的题,我在纸上划了半天,终于发现了,原来是这样:<br />对于 M*N的一个Gridland,<br />若M、N都为奇数,最短路线为 M*N+sqrt(2)-1<br />其它情况,M*N<br /> <br />再一个问题就是c++输出流格式的控制,之前没有认真研究过,刚才还是遇到了些麻烦。<br />记录一下:<br />#includ

bbplayers的专栏 756

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Python--ZOJ1037

Python--ZOJ1037

GuoJuXia的专栏 703

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

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

ZOJ1037解答

Apple Wang 1492

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ZOJ 1037 Gridland

HOJ 1037 Gridland问题 很简单的数学问题,大家一画图就知道,当m和n有一个为偶数时,刚好可以走完一圈,这就是最短路径,当m和n都为奇数时,走的过程中必须要走一个斜边,所以要在上一中情况下加上根号2. #include&lt;stdio.h&gt; int main() { int caseNumber,i; int N,M; scanf("%d",&am...

上帝是笨蛋的博客 308

ZOJ1037

一开始没有仔细想题目,看完了就傻傻的写了一个n*m的解法。。后面发现有一些特例 然后准备用搜索,之后想想发现没有这么烦,只需要找个规律就好了,n,m其中只要不是全是奇数,结果就是n*m,否则就是m*n-1+sqrt(2) #include #include #include using namespace std; int main(){ int cas; int n,m; cin>>c

Janathon_L的博客 627

zoj 1037 python

import sys n = int(raw_input()) for i in range(1, n+1) : num = sys.stdin.readline() an = num.split() a = int(an[0]) b = int(an[1]) if(a%2) and (b%2) : sum = a * b + 0.41

知行天下 1009

ZOJ-1037

Gridland Time Limit: 2 Seconds Memory Limit: 65536 KB BackgroundFor years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them effi

geek_jerome的博客 240

zoj-1037

为什么我说这题是简单的数学题? 被之前的DFS算法蛊惑了心智之后便自我痴迷于DFS结果真的就写起了DFS,我曹!谁知这题是数学题,也算是吸取了教训吧 在做题目之前应该吧这道题目转化为数学模型,或是一些算法模型,之后再组织自己的程序进行,这样的话就比较好! 打上代码! #include #include #include #include using namespace st

scanferror的博客 327

zoj1037

这道题把规律找出来后难度还行。主要分width*length的奇偶。当为偶数时,可以一步不重复地走完,当为奇数时,就要用平方根了。 #include #include int main() { float num; int n; int width,length; int count=0; scanf("%d",&n); while(n) {

zzu-hust-madd 517
上一篇: zoj 1001
下一篇: zoj 1048
tralonzhang
博客等级 码龄16年 5粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值