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);
}
【新华三】DHCP+TFTP+ZTP自动开局实战 设备运行ZTP功能,可以自动获取并自动加载开局文件,实现设备的免现场配置和部署,从而降低人力成本,提升部署效率。使用TFTP服务器工具进行文件的上传和下载,网上很多TFTP server软件,大家可以自行下载。3CDaemon等,可以根据使用自取所需。大家应该都了解ZTP,但是目前发现除了控制器之外仅使用ZTP开局的兄弟并不是很多,因此分享此过程方便大家批量开局,留出更多时间学习更多技术。电脑打开DHCP服务器,TFTP服务器,并通过网线连接到设备的管理口,若设备较多可以通过带外交换机等进行连接, 阅读详情

相关推荐

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

从S参数到SPICE模型:Cadence Sigrity Boardband SPICE完整使用指南

本文详细介绍了Cadence Sigrity Boardband SPICE工具的核心价值与完整使用流程。该工具通过矢量拟合算法,将复杂的多端口S参数文件转化为无源、紧凑且高精度的SPICE等效电路模型,从而极大提升时域仿真效率。指南涵盖了从数据导入、关键参数配置、模型精度验证到集成应用于PowerSI等系统级仿真的全步骤,是信号与电源完整性分析的必备利器。

defi6farmer的博客 432

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

从波形图到参数调优:一次无感BLDC电机启动失败的深度解析

本文深入解析无感BLDC电机启动失败案例,通过波形分析揭示参数不匹配和IPM保护机制触发等关键问题。详细探讨了过零点检测、PWM周期设置及强拖参数调优的底层逻辑,并分享IPM模块保护机制与实战调优技巧,最终实现99.98%的启动成功率。

weixin_29182481的博客 819

西门子S7-200 SMART与施耐德ATV变频器Modbus通讯实战:从接线到稳定运行的完整指南

本文详细介绍了西门子S7-200 SMART PLC与施耐德ATV变频器之间实现稳定Modbus通讯的完整实战指南。内容涵盖从硬件接线、参数配置、PLC程序编写到触摸屏设计的全流程,并分享了提升通讯稳定性的关键技巧和常见故障排查方法,助力工业自动化系统可靠运行。

kkk56的博客 1106

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

weblogic 集群搭建,双机部署,相关问题记录

4.5.集群搭建1 参考网址https://wenku.baidu.com/view/76365129cd1755270722192e453610661ed95aa4.html IP地址 端口 角色 192.168.1.160 9001 AdminServer ...

zl386119974的专栏 1669

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

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

lxt_Lucia的博客 828

GD32F103实战:用ADC+DMA实现高精度多通道电压采集与OLED实时显示(附完整工程)

本文详细介绍了如何利用GD32F103的ADC+DMA技术实现高精度多通道电压采集,并通过OLED实时显示数据。文章包含硬件架构设计、ADC配置技巧、DMA传输优化及显示系统实现方案,提供完整工程代码和调试指南,适用于工业传感器和环境监测设备开发。

weixin_42567497的博客 399

手把手教你用AirSim生成无人机训练数据集:RGB/深度图/分割图全攻略

本文详细介绍了如何使用AirSim仿真插件在UE4环境中生成无人机训练数据集,涵盖RGB、深度图和分割图等多种模态数据的采集与处理。通过实战指南,读者可以掌握环境配置、多模态数据采集、自动化流程设计及数据后处理等关键技术,为无人机视觉算法开发提供高质量训练数据。

weixin_29008805的博客 449

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

超声波传感器(CH101&ch201) - Ⅰ

压电微机械超声换能器(PMUT)和超声波信号处理的可编程片上系统(SoC)集成在一起的传感器

nicole088的专栏 2796

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硬件够破解文件,有需要的下载!

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

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

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

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

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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、付费专栏及课程。

余额充值