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. mysql启动错误处理

    1.当启动MySQL时,报如下错误 [ERROR] Plugin 'InnoDB' init function returned error.[ERROR] Plugin 'InnoDB' regis ...

  2. mysql 8.0.12 日常出错

    最近不知道怎么回事,数据库老是会输出一个: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and co ...

  3. 爬虫——Scrapy框架案例二:阳光问政平台

    阳光热线问政平台 URL地址:http://wz.sun0769.com/index.php/question/questionType?type=4&page= 爬取字段:帖子的编号.投诉类 ...

  4. Python字符串必记函数

    Python字符串函数数不胜数,想要记完所有几乎不可能,下列几个是极为重要的一些函数,属于必记函数. 一.join 功能: 将字符串.元组.列表中的元素以指定的字符(分隔符)连接生成一个新的字符串 语 ...

  5. iOS 12 真机调试 Xcode 9 提示 Could not locate device support files.

    升级 iOS 12 之后,使用 Xcode 9 真机调试会提示错误: Could not locate device support files. This iPhone 6 Plus is runn ...

  6. Spring Boot 多环境部署

    再简单的应用系统,通常都有两个环境——开发环境和线上环境.大型的企业应用还会有更多的环境,比如测试环境.准线上环境.演示环境等.应用的版本也可能对应了多个环境,比如1.0版本的演示环境.2.0版本的演 ...

  7. Oracle之多表查询

    -多表查询 1.交叉连接 select * from t_class for update; select * from t_student for update; select for update ...

  8. 树莓派3B的WiFi中文乱码及搜索不到附近的WiFi_解决方案:

    -----------------------------------------------------------学无止境------------------------------------- ...

  9. python之web架构

    一.web架构简介 web.py是一个轻量级Python web框架,它简单而且功能强大.web.py是一个开源项目.该框架由已故美国作家.Reddit联合创始人.RSS规格合作创造者.著名计算机黑客 ...

  10. linux 中文输出

    #include <stdio.h> #include <stdlib.h> #include <string> #include <fstream> ...