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 luckytime 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: mmcontains 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.

Sample Input

Input
3
11 23
Output
2
Input
5
01 07
Output
0

Hint

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.

题目意思:一个人想要在hh:mm时刻起床,而他想从在离起床时刻最近的一个带有数字7的时刻起,每x分钟按一次按钮,问一共按了多少次

解题思路:模拟即可,注意小时与分钟间的切换。

 #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int n,h,m,count;
while(scanf("%d%d%d",&n,&h,&m)!=EOF)
{
count=;
while()
{
if(h==||h==||m%==)
{
break;
}
else
{
count++;
m=m-n;
if(m<)
{
m=m+;
h--;
}
if(h<)
{
h=h+;
}
}
}
printf("%d\n",count);
}
return ;
}

Jamie and Alarm Snooze的更多相关文章

  1. CodeForces 916A Jamie and Alarm Snooze (水题)

    题意:给定一个数字n,和一个时间,问你每次可以把当前时间往回调n分钟,然后调多少次后时间中包含数字7. 析:直接模拟就好,从当前分钟向后调,注意调成负数的情况就好.很简单. 代码如下: #pragma ...

  2. 【Codeforces Round #457 (Div. 2) A】 Jamie and Alarm Snooze

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 暴力往前走x分钟就好. 直到出现7为止. [代码] #include <bits/stdc++.h> using nam ...

  3. CF916A Jamie and Alarm Snooze 题解

    Content 令一个时间为幸运时间,当且仅当该时间中包含数字 \(7\). 小 J 很懒,他决定在 \(h\) 时 \(m\) 分起床,于是他将闹钟设定在一个很幸运的时间,并通过按一次按钮以多睡 \ ...

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

    链接: https://vjudge.net/problem/CodeForces-916A 题意: Jamie loves sleeping. One day, he decides that he ...

  5. CCPC-Wannafly Summer Camp 2019 全记录

    // 7.19-7.29 东北大学秦皇岛校区十天训练营,题目都挂在了Vjudge上.训练期间比较忙,没空更博总结,回来继续补题消化. Day1 这天授课主题是简单图论,节奏挺好,wls两小时理完图论里 ...

  6. Android中对闹钟Alarm的事件处理

    之前的博文一直在持续分享Phone相关的知识也算是知识笔记,但在工作中难免遇到其他模块的一些问题,因此在解决这些问题的时候顺手将这些知识记录并分享出来.有些知识在不知道的时候会觉得非常难,当了解之后便 ...

  7. rtc关机闹钟2 Alarm manager

    public void set(int type, long triggerAtMillis, long windowMillis, long intervalMillis, PendingInten ...

  8. setup notifier actions in aodh alarm

    Aodh alarm NOTIFIER ==> alarm_actions URL: http://<host>/<action> NOTIFIER will resol ...

  9. Best Practices for Background Jobs_3 Managing Device Awake State之电源锁、Alarm、WakefulBroadcastReceiver

    http://developer.android.com/training/scheduling/index.html 当静置一个设备的时候,先会屏幕变暗,然后关闭屏幕,最后关闭CPU,以省电.但有的 ...

随机推荐

  1. JQuery制作网页—— 第七章 jQuery中的事件与动画

    1. jQuery中的事件: ●和WinForm一样,在网页中的交互也是需要事件来实现的,例如tab切换效果,可以通过鼠标单击事件来实现 ●jQuery事件是对JavaScript事件的封装,常用事件 ...

  2. React组件的使用

     一.index.js 文件[基本配置] //react语法塘 import React from 'react'; //reactDom用来操作虚拟DOM import ReactDom from ...

  3. Scala基本语法总结(一)

    Scala基本语法总结 时隔快一年了,又捡起scala,不是想学的有多么的精通,只是想把之前遇到的知识点和实践中遇到的重点进行归纳总结,对以后的面试或许有点帮助吧! 一.scala开发环境的配置 我这 ...

  4. python网络编程之进程

    一.什么是进程 进程(Process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础.在早期面向进程设计的计算机结构中,进程是程序的基本执行实 ...

  5. Java学习笔记二十四:Java中的Object类

    Java中的Object类 一:什么是Object类: Object类是所有类的父类,相当于所有类的老祖宗,如果一个类没有使用extends关键字明确标识继承另外一个类,那么这个类默认继承Object ...

  6. Java中的File.separator用法

    在Windows下的路径分隔符和Linux下的路径分隔符是不一样的,当直接使用绝对路径时,跨平台会暴出“No such file or diretory”的异常. 比如说要在temp目录下建立一个te ...

  7. 传说是小米家的一道面试题难倒了某Java程序员。扑克牌排序问题。

    网上说的是有位网友在面试小米Java岗三次后,终于挺进了第三轮面试,结果还是败在了两道算法题上面. 1.写个读方法和写方法,实现读写锁 2.一副从1到n的牌,每次从牌堆顶取一张放桌子上,再取一张放牌堆 ...

  8. python基础的一些知识点

    ord 将字符转换为ASCIIchr 将ASCII转换为字符 元组不可修改,当只有一个元素时,要添加一个逗号集合不可修改,元素无序,不能重复 列表.元组.字典都是可迭代对象,就是可以遍历的对象多层循环 ...

  9. Uber优步北京第二、三组奖励政策

    优步北京第二.三组: 定义为​2015年6月1日至今激活的司机(以优步后台数据显示为准) 滴滴快车单单2.5倍,注册地址:http://www.udache.com/如何注册Uber司机(全国版最新最 ...

  10. Spring Boot中使用缓存

    Spring Boot中使用缓存 随着时间的积累,应用的使用用户不断增加,数据规模也越来越大,往往数据库查询操作会成为影响用户使用体验的瓶颈,此时使用缓存往往是解决这一问题非常好的手段之一. 原始的使 ...