zoj 1745 Are We There Yet?

ESP32-CAM实战:从零构建高精度QR二维码识别系统 本文详细介绍了如何使用ESP32-CAM构建高精度QR二维码识别系统,涵盖硬件配置、开发环境搭建、二维码识别库选择与优化、完整系统实现及实战问题排查。通过优化识别算法和电源管理,系统可实现快速、稳定的二维码识别,适用于物联网设备绑定等场景。 阅读详情

Are We There Yet?

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Laurie's little brother Joey has been playing Find the Cookie with her. However, after the 32,767th time, Laurie is tired of it. She wants to write a program to keep the boy occupied. Write a program to simulate a game of Find the Cookie. The game takes place in a long narrow hall, so Joey can only move forward and backward, not right or left. At the beginning of each game, a cookie is placed in the hall (not at the center of the hall) and Joey starts at the center of the hall. Joey attempts to find the cookie. He does this by moving to another point in the hall, whereupon the computer tells him whether he is "warmer" (he has moved closer to the cookie than his last position), "colder" (he has moved farther away from the cookie than his last position), "same" (he has not moved closer or farther away from the cookie), or he has reached the cookie. Joey continues until he exactly reaches the location of the cookie, which always happens within 20 moves. 


Input

Each input line represents a new game. Each input line contains at least two and at most 21 integers separated by whitespace. The integers represent locations along the hall, expressed in units of feet. Joey begins each game at location 0 feet. The first integer on an input line is the location of the cookie. This integer is guaranteed to be different from 0. The remaining integers represent locations Joey moves to, in order. Joey will never move more than 5280 feet from his original location. Joey will always reach the cookie in each game, and this will be the last move on the input line. Your program should stop processing input lines when the cookie is located at 5280 feet (a mile from the center of the hall is way too far for Joey to go for only one cookie).


Output

For each location that Joey moves to, determine whether he is warmer, colder, the same, or has reached the cookie. Have a blank line between the output for different input lines. Follow the format in the Sample Output.


Sample Input

5 10 11 12 3 4 5
3 10 10 7 3
12 5 -3 1 4 6 7 8 9 12
5280 10


Sample Output

Moving from 0 to 10: same.
Moving from 10 to 11: colder.
Moving from 11 to 12: colder.
Moving from 12 to 3: warmer.
Moving from 3 to 4: warmer.
Moving from 4 to 5: found it!

Moving from 0 to 10: colder.
Moving from 10 to 10: same.
Moving from 10 to 7: warmer.
Moving from 7 to 3: found it!

Moving from 0 to 5: warmer.
Moving from 5 to -3: colder.
Moving from -3 to 1: warmer.
Moving from 1 to 4: warmer.
Moving from 4 to 6: warmer.
Moving from 6 to 7: warmer.
Moving from 7 to 8: warmer.
Moving from 8 to 9: warmer.
Moving from 9 to 12: found it!

注意看输出格式

参考代码:

#include <iostream>
#include <stdio.h>
using namespace std;
int abs(int a){
	if (a>0)
		return a;
	return -a;
}
int main(){
	int first,second,flag=0,last,location;
	while (~scanf("%d",&location)){
		
		if (location==5280){
			while (~scanf("%d",&second));
			break;
		}
		if (flag++)
			printf("\n");
		first=0;
		while (~scanf("%d",&second)){
			if (second==location){
				printf("Moving from %d to %d: found it!\n",first,second);
				break;
			}
			else{
				int l=abs(second-location),r=abs(first-location);
				if (l>r)
					printf("Moving from %d to %d: colder.\n",first,second);
				if (l==r)
					printf("Moving from %d to %d: same.\n",first,second);
				if (l<r)
					printf("Moving from %d to %d: warmer.\n",first,second);
			}
			first=second;
		}
	
	}
	return 0;
}




OpenClaw 2026 路线图详解:3 大协作能力升级与社区贡献增长 62% 的实证分析 介绍 OpenClaw 2026 如何通过上下文锚定(Context Anchoring)、协作质量定义和责任边界机制,将 AI 编程工具从单点补全升级为嵌入代码生命周期的协作对齐系统,并详解 `.openclaw/config.yaml` 中 `context_anchor` 配置的实操方法与效果 阅读详情

相关推荐

青龙面板实战:用快手极速版脚本日赚XX元的核心参数解析

本文深入解析了青龙面板运行快手极速版脚本的核心参数配置,旨在帮助进阶用户提升收益稳定性。重点剖析了设备标识符(did)的获取原理、多账号Cookie的精准拼接规则,以及如何通过科学设置定时任务频率来量化并优化收益,实现细水长流的稳定收益。

weixin_29310605的博客 1073

fjnu 1298 Are We There Yet?

DescriptionLauries little brother Joey has been playing Find the Cookie with her. However, after the 32,767th time, Laurie is tired of it. She wants to write a program to keep the boy occupied. W

异リ度ュ空ウ間(镜像站) 665

联想ThinkServer SR588 重装raid5阵列信息(装完centos7后,找不到硬盘)

这里写自定义目录标题找不到硬盘选择光盘启动 找不到硬盘 装完centos7之后,提示重启,重启之后,就一直无法启动。 进入bios 看了,确实是有设置硬盘为第一启动选项。 选择光盘启动 本地标准硬盘也是找不到。 1、 重启进入bios在系统手设置里找到存储信息, 然后找到如图选项回车进入。 选择主目录进入。 进入Configuration Management 里面 先清除原来的设置信息 选择已启用在yes 提示清除成功。 返回上一目录选择,选择 Create Virtual Drive 再选择S

熠铭心时空的博客 2万+

ZOJ-1745

水题一道。。 #include #include int main() { int cookie, count = 0; while (scanf("%d", &cookie), cookie != 5280) { if (count++) putchar('\n'); int now, prev = 0, pd = abs(cookie), nd; while (sc

xhldtc的专栏 686

[SystemC]SystemC中的模块和程序

SystemC 中的层次结构是使用类 sc_module 创建的。sc_module 可以直接使用,也可以使用宏 SC_MODULE “隐藏”。上面的示例 SC_MODULE 创建了一个名为 nand2 的 sc_module 类对象。它的输出纯粹是输入值的函数。因此,模型可以使用最简单的 SystemC 进程,即 SC_METHOD。摘要:本节包含一个完整的简单设计,用于演示 SystemC 中模块和流程的使用。同样,重要的是要注意这不是典型的设计风格 - 但它很好而且易于理解。为什么要看模块和流程?

元直的博客 1867

YOLOv8改进 | Conv篇 | 利用YOLOv9的GELAN模块替换C2f结构(附轻量化版本 + 高效涨点版本 + 结构图)

本文给大家带来的改进机制是利用2024/02/21号最新发布的YOLOv9其中提出的GELAN模块来改进YOLOv8中的C2f,GELAN融合了CSPNet和ELAN机制同时其中利用到了RepConv在获取更多有效特征的同时在推理时专用单分支结构从而不影响推理速度,同时本文的内容提供了两种版本一种是参数量更低涨点效果略微弱一些的版本(参数量V8n下降80w,计算量为6.1GFLOPs),另一种是参数量稍多一些但是效果要不参数量低的效果要好一些(均为我个人整理),提供两种版本是为了适配不同需求的读者,具体选择

Snu77的博客 7566

【Java】ZOJ刷题——1001 a+b problem

任务与代码 【ZOJ1001】a+b problem Calculate a + b Input The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line. Output For each pair of input i...

陈happy的博客 971

Centos7系统添加中文支持(附中文语言包)

这里以centos7.6为例,在安装系统是没有选择中文,之后如果需要添加中文支持。在命令行执行后,会提示启动图形模式失败,转为启动文本模式。文本模式其实和图形模式差不多,操作需要用键盘而不是鼠标。在弹窗后,通过上下键选择Chinese(P.R of China) - 中文(简体):然后,按Tab键选择Yes,点击回车。rebootlocale可以看到系统语言已经变成了zh_CN.utf-8:之后,服务器上的中文名称就可以正常显示正常了。

悦分享 682

ZOJ 1745 Are We There Yet?

//2615366 2011-08-04 19:16:25 Accepted 1745 C 0 160 ylwh! //2615361 2011-08-04 19:12:41 Presentation Error 1745 C 0

我辈皆愚 588

RML2018.01a数据集的读取与使用

基于深度学习的自动调制识别

QAQIknow的博客 1万+

IEEE69节点数据(Matlab)

IEEE69节点数据(Matlab)

weixin_46039719的博客 1162

zoj1745 Are We There Yet?

Are We There Yet? Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Submit Status Description Laurie's little brother Joey has been playing Find t

acm_1361677193的专栏 350

LibCity:开源的交通预测算法库 | 面向小白,从0到1【SUMO十字路口仿真建模】路网搭建、车辆配置、实现仿真、仿真结果输出

LibCity:开源的交通预测算法库 | 面向小白,从0到1【SUMO十字路口仿真建模】路网搭建、车辆配置、实现仿真、仿真结果输出

追光者♂:记录、分享、总结、提升,现象级专栏《Python从入门到人工智能》作者,无惧黑暗,坚信曙光 457

Are We There Yet? (zoj1745)

Are We There Yet?     (ZOJ Problem Set - 1745) Are We There Yet? Time Limit: 2 Seconds      Memory Limit: 65536 KB Laurie's little brother Joey has been playing Find the Cookie with he

huadong_fcy56的博客 326

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

NTscan扫描工具

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

poj3663 Costume Party

Costume Party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11793   Accepted: 4770 Description It's Halloween! Farmer John is taking the cows to a costum

Jinbao 2142

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

金色十月线上编程比赛第一题:小女孩数数

金色十月线上编程比赛第一题:小女孩数数 题目详情: 【金色十月线上编程比赛规则】 一个小女孩正在用左手手指数数,从1数到n。她从拇指算作1开始数起,然后,食指为2,中指为3,无名指为4,小指为5。接下来调转方向,无名指算作6,中指为7,食指为8,大拇指为9,如此反复。问最后会停在那个手指上?用编号1、2、3、4、5依次表示大拇指、食指、中指、无名指、小指。 输入格式

Jinbao 2104

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

hdu4565 So Easy!(矩阵快速幂)

题意: 告诉你a,b,n,m,求 0 解题思路:     我们首先对(a+sqrt(b))^n进行处理,由a+sqrt(b))^n的展开式我们可以知道 (a+sqrt(b))^n = Xn + Yn * sqrt(b); 那么 ( a + sqrt( b ) )^( n + 1 ) = ( a + sqrt( b ) ) * ( Xn + Yn * sqrt(b) ) = (

Jinbao 1865

四川大学线下编程比赛第一题:数字填充

四川大学线下编程比赛第一题:数字填充 发布公司: 有 效 期: 优快云 2014-09-27至2015-09-26 难 度 等 级: 答 题 时 长: 编程语言要求: 120分钟 C C++ Java C# 题目详情 peter喜欢玩数字游戏,但数独这样的游戏对他来说太简单了,于是他准备玩一个难的游戏。游戏规则

Jinbao 1764

线段树多lazy-tag(两个)

线段树多lazy-tag(两个)题意:有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。 解题思路: 结构体定义:typdef long long ll; struct Node{ int l,r; l

Jinbao 1587

四川大学线下编程比赛第二题:Peter的X

四川大学线下编程比赛第二题:Peter的X 发布公司: 有 效 期: 优快云 2014-09-27至2015-09-26 难 度 等 级: 答 题 时 长: 编程语言要求: 120分钟 C C++ Java C# 题目详情 Peter是个小男孩,他总是背不清26个英文字母。于是,刁钻的英语老师给他布置了一个非常

Jinbao 1455

poj 3618 Exploration

Exploration Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3826   Accepted: 1850 Description Bessie is traveling on a road teeming with interesting landma

Jinbao 1391

金色十月线上编程比赛第二题:解密

金色十月线上编程比赛第二题:解密 发布公司: 有 效 期: 优快云 2014-10-20至2015-10-20 难 度 等 级: 答 题 时 长: 编程语言要求: 120分钟 C C++ Java C# 题目详情 小强是一名学生, 同时他也是一个黑客。 考试结束后不久,他惊讶的发现自己的高等数学科目居然挂了,于

Jinbao 1275

poj 1331 Multiply

Multiply Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5179   Accepted: 2773 Description 6*9 = 42" is not true for base 10, but is true for base 13. That

Jinbao 1273

初学DP(1) 黑书中的《括号序列》

题目:括号序列 定义如下规则序列(字符串): 1.空序列是规则序列; 2.如果S是规则序列,那么(S)和[S]也是规则序列; 3.如果A和B都是规则序列,那么AB也是规则序列; 例如,下面的字符串都是规则序列: (),    [],    (()),    ([]),    ()[()]; 而这几个就不是规则序列: (,    [,    )(,    ([]; 现在给出一些有'

Jinbao 1269

poj 1577 Falling Leaves

Falling Leaves Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4066   Accepted: 2249 Description   Figure 1 Figure 1 shows a graphical representation o

Jinbao 1249

hdu4578(三个更新操作,三个求值操作)

题意:有长为n的数列,初始化为全部为0,我们对它有三个操作: (1)把数列中的一段区间全部乘一个值;  (2)把数列中的一段区间全部加一个值;  (3)把数列中的一段区间全部替换成一个值; 然后再对它有一个查询操作: 求数列中的一段区间的每个数的p次方之和(1 解题思路:     因为p只有三个值,所以我们可以将这三个值分别进行求解,我将它们定义为sum,sum2,sum

Jinbao 1225
上一篇: poj3904 Sky Code
下一篇: poj 1775 && zoj 2358 Sum of Factorials
JinbaoSite0144
博客等级 码龄12年 231粉丝 157原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值