codeforces 916 A Jamie and Alarm Snooze

Labview时钟snooze闹钟 利用labview所设计的时钟,实现了定时,snooze,闹钟,显示等功能 立即下载

Description


Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the snooze button every x minutes until hh: mm is reached, and only then he will wake up. He wants to know what is the smallest number of times he needs to press the snooze button.

A time is considered lucky if it contains a digit ‘7’;. For example, 13: 07 and 17: 27 are lucky, while 00: 48 and 21: 34 are not lucky.

Note that it is not necessary that the time set for the alarm and the wake-up time are on the same day. It is guaranteed that there is a lucky time Jamie can set so that he can wake at hh: mm.

Formally, find the smallest possible non-negative integer y such that the time representation of the time x·y minutes before hh: mm contains the digit ‘7’.

Jamie uses 24-hours clock, so after 23: 59 comes 00: 00.
Input


The first line contains a single integer x (1 ≤ x ≤ 60).

The second line contains two two-digit integers, hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59).
Output


Print the minimum number of times he needs to press the button.
Examples

InputOutput
3
11 23
2
InputOutput
5
01 07
0

Note


In the first sample, Jamie needs to wake up at 11:23. So, he can set his alarm at 11:17. He would press the snooze button when the alarm rings at 11:17 and at 11:20.

In the second sample, Jamie can set his alarm at exactly at 01:07 which is lucky.


题意:Jamie要在某一时刻起床,但希望在某一个含7的幸运时刻被闹钟吵醒,然后在恰好经过若干个x分钟的小睡后到达该时刻。
只需要模拟一个表从起床时刻开始,每次把时间向前调x分钟,最先遇到的含7的时刻就是答案。

#include <stdio.h>

class clock {
public:
    int x;
    int hh;
    int mm;
    bool luck() {
        if (hh % 10 == 7||mm%10==7)return true;//含7的只可能是个位
        else return false;
    }
    void dec() {//模拟时钟
        mm = mm - x;
        if (mm < 0) {
            mm += 60;
            hh--;
        }
        if (hh < 0)hh += 24;//前一天
    }
};

int main() {
    clock time;
    scanf("%d", &time.x);
    scanf("%d %d", &time.hh, &time.mm);
    int t;
    for (t = 0; !time.luck(); ++t)  time.dec();
    printf("%d", t);
}
IEC61850实战:从ICD文件解析到模型构建 本文深入解析IEC61850标准中的ICD文件结构,从Header、IED到DataTypeTemplates部分,详细介绍了如何构建电力自动化设备的数据模型。通过实战案例展示ICD文件的创建过程,并分享常见问题的调试技巧,帮助工程师快速掌握IEC61850建模方法,提升电力系统自动化项目的实施效率。 阅读详情

相关推荐

线结构光三维重建(二):光平面标定与激光轮廓提取的实战优化

本文深入探讨了线结构光三维重建中的光平面标定与激光轮廓提取两大核心环节的实战优化。详细介绍了从棋盘格标定板法到自动化高鲁棒性标定的流程优化,并分享了针对复杂工业场景(如低对比度、高反光表面)的激光轮廓提取组合策略,旨在提升三维重建系统的整体精度与稳定性。

weixin_29057237的博客 330

A. Jamie and Alarm Snooze

time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he ...

无知的我 728

【深度解析】信息素养提升实践活动(附:历年获奖作品分析)

全国师生信息素养提升实践活动是由教育部教育技术与资源发展中心(中央电化教育馆)主办,面向全国师生的一项信息化交流展示活动。

m0_74417957的博客 9649

Codeforces Round #457 (Div. 2) A. Jamie and Alarm Snooze简单模拟

A. Jamie and Alarm Snooze time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jamie loves sleeping. One day, he

Frost_Bite的博客 520

Unity程序化河流生成工具Waterways:从算法到实践的全流程解析

程序化内容生成(PCG)是游戏开发与三维建模领域的关键技术,它通过算法自动创建游戏内容,显著提升开发效率。其核心原理是将设计规则转化为可执行的代码逻辑,从而生成复杂、多样且符合自然规律的环境资产。在开放世界游戏和模拟经营类项目中,程序化生成技术能够快速构建大规模、高一致性的自然场景,如山川、森林与水体网络。Unity引擎作为广泛使用的开发平台,其地形系统与着色器管线为程序化工具的集成提供了强大基础。本文聚焦于利用Waterways这一Unity工具集,深入探讨如何通过模拟重力驱动、流量累积等自然水力原理,在

weixin_33690963的博客 684

从UART到RS485:手把手教你用SIT3485E收发器搞定工业级通信(含原理图与PCB布局要点)

本文详细解析了从UART到RS485的工业级通信转换,重点介绍了SIT3485E收发器的原理图设计、PCB布局要点及抗干扰技巧。通过差分信号传输和优化电路设计,实现长距离、多设备稳定通信,适用于工业自动化等复杂环境。

weixin_29169505的博客 348

Codefroces 916A Jamie and Alarm Snooze

Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He wi

Puppet__的博客 662

PCIe学习笔记(一)-------1.3 PCIe数据包(TLP,DLLP,PLP)

1,PCIe的层次结构 PICe设备在硬件电路上可以分为三个层次结构:事务层(Transaction Layer)、数据链路层(Data Link Layer)、物理层(Physical)。每一个层次又可以分为两个部分,分别为处理发送和处理接收的部分。 也可以分为四个层次,将事务层以上的层次称为软件层(Software Layer)。 2,PCIe数据包 前面已经说过PCIe之间是以数据包的形式来传输数据的,协议共定义了3类数据包。与处理层相关的是处理层数据包(TLP),与数据链路层相关的是数据

llxxyy507的博客 2万+

Jamie and Alarm Snooze(起床时间,延迟闹铃)

欢迎访问https://blog.youkuaiyun.com/lxt_Lucia~~宇宙第一小仙女\(^o^)/~~萌量爆表求带飞=≡Σ((( つ^o^)つ~dalao们点个关注呗~~emmm都喊我铁头,哼!!!而我的床呢偏偏就是磁铁打的........but每天还是要起床.....比如更博,therefore....没事多来瞅瞅给我增点访客量咯~这个叫Jamie的小盆友还真是像我一样爱睡觉,这个闹铃延迟提...

lxt_Lucia的博客 828

【华为OD机试真题】65、高矮个子排队 | 机试真题+思路参考+代码解析 (C++、Java、Py、C语言、JS)

题目描述 >现在有一队小朋友,他们高矮不同,我们以正整数数组表示这一队小朋友的身高,如数组{5,3,1,2,3}。 >  我们现在希望小朋友排队,以"高" "矮" "高" "矮" 顺序排列,每一个高位置的小朋友要比相邻的位置高或者相等;每个 "矮" 位置的小朋友要比相邻的位置矮或者相等; >  要求小朋友们移动的距离和最小,第一个从“高"位开始排,输出最小移动距离即可。 >  例如,在示范小队{5,3,1,2,3}中, {5, 1, 3, 2, 3}是排序结果。 > 

KJ.JK 2098

手把手教你学PCIE--基本概念:PCIe 初始化流程概述

硬件上电复位:系统上电时,所有 PCIe 设备都会进行复位。链路训练(Link Training):主机和设备之间通过链路训练状态机(LTSSM)协商链路参数(如速度和宽度)。配置空间访问:主机通过配置空间读写来发现和配置设备。资源分配:主机为设备分配内存映射 I/O 区域(BARs)、中断向量等资源。驱动程序加载和高级配置:操作系统加载设备驱动程序,并进行更高级的配置和状态监控。硬件上电复位:确保所有设备处于已知的良好状态。链路训练:主机和设备通过 LTSSM 协商链路速度和宽度。

MHD0815的博客 1373

Codeforces 916A Jamie and Alarm Snooze

A. Jamie and Alarm SnoozeJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the al...

s540239976的博客 340

Fastgpt本地使用Docker Compose 快速部署

修改文件,并执行再执行d重起容器。具体配置,参考配置详解。可以查看日志,在启动容器后,第一次请求网页,会进行配置文件读取,可以看看有没有读取成功以及有无错误日志。进入 FastGPT 容器,可以通过ls data查看目录下是否成功挂载文件。可通过查看配置文件。可能不生效的原因挂载目录不正确配置文件不正确,日志中会提示invalid json,配置文件需要是标准的 JSON 文件。

洛阳泰山的博客 1633

CodeForces-916A-jamie and Alarm Snooze(笨比题目)

链接: https://vjudge.net/problem/CodeForces-916A 题意: Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up...

weixin_30693683的博客 147

WINCC7.3破解文件

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

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Codeforces 916-A

A. Jamie and Alarm Snooze time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Jamie loves sleeping. One day, he decides that he needs to wake

辞树 463

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

916A - Jamie and Alarm Snooze

A. Jamie and Alarm Snooze time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jamie loves sleeping. One day, he

memory_qianxiao的博客 548

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

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

codeforces 916E Jamie and Tree 题解

题意简述 给定一个 n≤105n\le 10^5n≤105 个点带权的树,初始根为 111。支持三种操作: 1 r 把根换成 rrr 2 u v x 把 LCA(u,v)LCA(u,v)LCA(u,v) 的子树整体加 xxx 3 u 查询 uuu 的子树点权和 操作数≤105\le 10^5≤105。每个点权 ≤108\le 10^8≤108 。 思路 如果没有 111 操作,那 2,32,32,...

LightningUZ的博客 312

Codeforces 907A Masha and Bears

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes i

toby的博客 688

Codeforces Round #374 (Div. 2) D 贪心+优先队列

链接:戳这里 D. Maxim and Array time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Maxim has found an array of n integers, neede

Cross 633

[CF916E]Jamie and Tree——树链剖分+线段树

题目大意: 有一棵n个点的树,每个节点上有一个权值wi,最开始根为1号点.现在有3种 类型的操作: • 1 root, 表示将根设为root. • 2 u v x, 设u, v的最近公共祖先为p, 将p的子树中的所有点的权值加上x. • 3 u, 查询u的子树中的所有点的权值和. 对于每个3操作,输出答案. 思路: 如果真的换根的话肯定是不行的。。。所以我们要想办法在原树上面搞出不...

ylsoi的博客 795

[简单思维题] Jamie and Alarm Snooze

题目描述 Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh:mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky ...

dingfei496705的博客 191

Jamie and Tree( Codeforces 916E)

题意: 给出一个有n个点以及n-1条边的树,进行3个操作: 1. 将x变成整个树的根 2. 将以x,y相对于根的最近公共祖先的为根的那棵子树的所有根节点加上z. 3. 查询以x为根的子树的所有节点的和 算法: LCA,DFS序,线段树区间维护 解题思路: 首先考虑不对根进行修改,通过对根与询问节点的相对位置关系分析,通过求LCA实现各个操作。由于每一次操作修改的点不确定,

sdut16szq的博客 587

第0周周赛——极限手速赛(题解)之上篇

A题: A题题目链接 题目描述: 这道题是一血 TimeLimit:500MS  MemoryLimit:64MB 64-bit integer IO format:%I64d admin Problem Description 编辑 什么?这道题竟然没有题目描述? Input 编辑 输入只有一行,包含一个整数

多反思,多回顾,要坚持。 1718

Jamie and Alarm Snooze

Jamie and Alarm Snooze Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by set

codeswarrior的博客 464

C - C CodeForces - 916A(模拟)

Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He ...

做一只熊猫不好吗? 279
上一篇: codeforces 915 C Permute Digits
下一篇: codeforces 914 D Bash and a Tough Math Puzzle
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值