Garden CodeForces - 915A

量化策略缺数据?一份QMT/PTrade免费数据清单与特殊数据源QtFactor评测 本文为量化策略开发者提供QMT和PTrade平台的免费数据资源清单,并深度评测QtFactor在补充特色数据方面的价值。涵盖Tick级数据、Level2行情、资金流向等关键信息,帮助开发者在预算有限的情况下构建高效数据解决方案,特别适合打板策略和日内回转交易。 阅读详情

Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water any parts of the garden that were already watered, also she can't water the ground outside the garden.

Luba has to choose one of the buckets in order to water the garden as fast as possible (as mentioned above, each hour she will water some continuous subsegment of length ai if she chooses the i-th bucket). Help her to determine the minimum number of hours she has to spend watering the garden. It is guaranteed that Luba can always choose a bucket so it is possible water the garden.

See the examples for better understanding.

Input

The first line of input contains two integer numbers n and k (1 ≤ n, k ≤ 100) — the number of buckets and the length of the garden, respectively.

The second line of input contains n integer numbers ai (1 ≤ ai ≤ 100) — the length of the segment that can be watered by the i-th bucket in one hour.

It is guaranteed that there is at least one bucket such that it is possible to water the garden in integer number of hours using only this bucket.

Output

Print one integer number — the minimum number of hours required to water the garden.

Example
Input
3 6
2 3 5
Output
2
Input
6 7
1 2 3 4 5 6
Output
7
Note

In the first test the best option is to choose the bucket that allows to water the segment of length 3. We can't choose the bucket that allows to water the segment of length 5 because then we can't water the whole garden.

In the second test we can choose only the bucket that allows us to water the segment of length 1.


读题真是硬伤,一开始第二个样例一直搞不懂怎么出来的,后来才明白,选择一个桶后,就只能只用这一个桶了,不能多不能少,找最大因子就可以,遍历一边

code:

#include <iostream>
#include <cstdio>
using namespace std;
int a[120];
int n,k;
int main(){
    scanf("%d%d",&n,&k);
    int i;
    for(i = 0; i < n; i++)
        scanf("%d",&a[i]);
    int minh = 999999;
    for(i = 0; i < n; i++){
        if(k%a[i]==0){
            if(k/a[i]<minh)
                minh = k/a[i];
        }
    }
    printf("%d\n",minh);
    return 0;
}


DIY电磁炉核心驱动方案:IR2153PBF自振荡半桥芯片实战指南(附电路图) 本文详细介绍了IR2153PBF自振荡半桥驱动芯片在DIY电磁炉核心驱动方案中的实战应用。该芯片集成了振荡器与600V高压驱动能力,仅需少量外围元件即可生成互补带死区的PWM信号,极大简化了半桥逆变电路设计。文章深入解析了其工作原理、关键参数,并提供了完整的电路设计、PCB布局指南及调试步骤,帮助电子爱好者构建稳定高效的感应加热驱动核心。 阅读详情

相关推荐

OpenBLT开源Bootloader深度解析:从架构原理到嵌入式OTA实战

Bootloader(引导加载程序)是嵌入式系统启动和固件更新的核心组件,其核心原理在于管理MCU的启动流程与内存空间。它通过隔离自身与应用程序的存储区域,并实现可靠的通信协议,为设备提供了远程固件升级(OTA)的能力,这对于工业控制、物联网设备等需要长期维护和功能迭代的场景具有重要技术价值。OpenBLT作为一个高度可移植的开源Bootloader解决方案,借鉴了汽车电子领域的XCP协议,确保了在UART、CAN等通信接口上数据传输的可靠性。本文聚焦于OpenBLT的核心架构、内存管理、通信协议保障以及具

快马扬鞭须努力! 458

A-Garden

A. Gardentime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLuba thinks about watering her garden. The garden can be represented as a segment of lengt

qq_40129237的博客 503

qt实现程序密钥注册功能,MD5加密+AES加密,并实现一台电脑系统一个密钥

qt实现了一个给自己软件加密的功能。 原理是: 需要被注册的软件第一次运行的时候,在系统的注册表里面注册一个键值,如下: 这个值作为生成密钥的用户识别号,然后生成密钥文件key.db,把这个key.db文件放到软件执行目录下,即可完成软件的注册并正常使用软件。 软件第一次打开的界面及密钥生成工具软件界面如下: 将密钥生成工具软件生成的key.db放到软件执行目录下之后,软件即可正常使用,如下图: 代码使用了MD5加密 外加 AES加密, 解密和加密的核心代码如下: QSt.

weixin_43935474的博客 4134

codeforces 920A Water The Garden

A. Water The GardenIt is winter now, and Max decided it's about time he watered the garden.The garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (...

s540239976的博客 702

MAX96712在车载摄像头系统中的带宽分配与传输能力计算解析

在计算摄像头带宽与传输接口的关系时,需要考虑视频流的像素分辨率、帧率、颜色深度等因素。以 MAX96712 这种 GMSL2 产品为例,它支持每个链路在正向方向以 3Gbps 或 6Gbps 的固定速率工作。

weixin_43199439的博客 3342

JLINK/SWD/STLINK下载选项区别

摘要: 本文对比了JLINK/SWD/STLINK的6种下载模式:Normal(硬件复位)、Hot plug(无复位)、Under reset(持续复位后连接)、Software reset(软件复位)、Hardware reset(全复位)和Core reset(内核复位)。重点分析了各模式的操作逻辑、适用场景及注意事项,其中Under reset模式是解决SWD禁用/程序异常的首选方案。通过对比表归纳了复位范围、NRST操作等核心差异,并给出场景选择建议:排查连接问题优先选Under reset,常规调

亚洲程序员盟主得博客 405

Luba and her garden

Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of lengt

lingxltime的博客 899

国产AI芯动力:复旦微FMQL100TAI900 FPGA原型验证板全解析

本文全面解析了复旦微FMQL100TAI900 FPGA原型验证板在国产AI硬件领域的创新突破。该板卡采用全栈国产化设计,具备出色的AI推理性能、视频处理能力和接口生态,特别适合工业质检、智能交通等场景。文章详细介绍了其芯片架构、存储子系统、接口扩展及电源设计,并分享了实战开发经验,为开发者提供了一套可靠的国产计算平台解决方案。

weixin_29250573的博客 460

A. Water The Garden

A. Water The Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is winter now, and Max decided it's a

Become hunger become strong 1188

面向高分辨率遥感影像的建筑物有效分割方法:基于UNFormer的全局与局部结构特征建模

基于UNFormer的建筑物遥感图像语义分割模型实现 摘要:本文介绍了一种结合CNN与Transformer优势的UNFormer模型,用于解决建筑物遥感图像语义分割任务。该模型采用U形结构设计,编码器基于CNN提取局部特征,瓶颈层使用Transformer捕捉全局依赖关系,解码器通过上采样融合多尺度特征。实验在WHU建筑物数据集上进行,可视化结果显示模型能有效处理建筑物密集区域和复杂边缘。文章提供了从环境搭建、数据处理到模型实现的完整教程,包括PyTorch代码实现细节,帮助读者快速复现这一先进的语义分割

m0_71589036的博客 5370

智能温室:温室环境监测_(7).土壤监测技术包括pH值和电导率

土壤的pH值是指土壤溶液的酸碱度,它对植物的营养吸收和生长发育有着重要的影响。在智能温室中,土壤监测是非常重要的一个环节,因为土壤的pH值和电导率直接影响植物的生长和健康。本节将详细介绍如何利用传感器和数据处理技术来监测土壤的pH值和电导率,并提供具体的代码示例。在智能温室中,监测到的土壤pH值和电导率数据需要传输到中央控制系统进行进一步的处理和分析。通过以上步骤,您可以构建一个完整的智能温室土壤监测系统,实时监控土壤的pH值和电导率,确保植物在最佳的生长环境中。校准通常包括在已知电导率的标准溶液中进行。

zhubeibei168的博客 1411

codeforces-#459A Pashmak and Garden

题目大意:        解题思路:        c

VoidSun 448

【WRF模拟】如何查看 WPS 的输入静态地理数据(二进制格式)?

如何查看 WPS 的输入静态地理数据(二进制格式)?

WW、forever的博客 645

codeforces 915A Garden

点击打开链接 A. Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Luba thinks about watering her garde

zhang__liuchen的博客 254

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

怀旧版电脑GBC模拟器

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

A. Garden

欺负人的水题:http://codeforces.com/problemset/problem/915/A 错误代码: #include&lt;iostream&gt; #include&lt;algorithm&gt; using namespace std; int main() { int n, k, i; int a[101]; cin &gt;&gt; n &gt;&gt; k;...

笨鸟先飞 304

NTscan扫描工具

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

Python水题记录

1 Codeforces 915A Garden 1 #!/usr/bin/env python 2 # coding: utf8 3 4 import sys 5 6 def main(): 7 #sys.stdin = open('A.in', 'r') 8 #sys.stdout = open('A.out', 'w') 9...

weixin_30765319的博客 183

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

D - Garden

Problem description Luba thinks about watering her garden. The garden can be represented as a segment of lengthk. Luba has gotnbuckets, thei-th bucket allows her to water some continuous sub...

weixin_30853329的博客 154

只有一种英雄主义,就是在认清生活真相之后依然热爱生活

只有一种英雄主义,就是在认清生活真相之后依然热爱生活——罗曼罗兰 【捕鱼人的故事】 先抛开马斯洛的五大需求层次理论来说(人的生理、安全需求满足后要发展更高层次的需求,一直到追求最高层次的自我实现)这个故事中没有谁的选择是对,谁的选择是错的问题,只是不同选择,不同人生罢了。虽然看起来终点都一样——在海边的小渔村过悠哉的生活,但是过程却完全不一样。如果你觉得安于现状是你想要的,那选择安于现状的生活

李铎 我是船长 1617

codeforce 915 B Browser

Luba is surfing the Internet. She currently has n opened tabs in her browser, indexed from 1 to n from left to right. The mouse cursor is currently located at the pos-th tab. Luba needs to use the tab

toby的博客 784

915A Garden

A. Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Luba thinks about watering her garden. The garden

memory_qianxiao的博客 724

Educational Codeforces Round 46 (Rated for Div. 2)

A. Codehorses T-shirts 题意:找出两份名单中不同衣服大小的个总件数 解法:map模拟一下就行 #include&amp;lt;bits/stdc++.h&amp;gt; using namespace std; typedef long long LL; map&amp;lt;string,int&amp;gt;mp,mp2; int main() { int n; cin&amp;gt;...

blue_kid的博客 498

CodeForces 915A

题目链接 https://vjudge.net/problem/CodeForces-915A 题意 长度为k的花园,有n个不同的水壶,每个水壶一小时可以浇ai长度的花园,只能选择一个水壶,不能多浇也不能少浇水,问至少需要几个小时。 思路 排序之后从最大的最小的搜,如果有一个能整除n,就是答案。 AC代码 #include&amp;amp;lt;cstdio&amp;amp;gt; #include...

Morphling_____ 221

SAPever garden需复习语法

SAPever garden——PP

a574115360的博客 181

Codeforces 459A Pashmak and Garden(水题)

题目链接:Codeforces 459A Pashmak and Garden 题目大意:给定两点,确定正方形,多种方案输出一种即可。不行输出-1. 解题思路:给定点无非三种情况。分类讨论即可。 #include #include #include #include using namespace std; int x1, x2, y1, y2; int x3, x4,

不慌不忙、不急不躁 1357

洛谷CF920A Water The Garden

题意翻译 有一个长度为n的花园,一共有k个水龙头,分别在x[1],x[2]...x[k]的位置。第t秒每个水龙头可以浇灌到它的前第t个方格和它后第t个方格,问浇灌完花园的时间。 感谢@伏轩彤666 提供的翻译 题目描述 It is winter now, and Max decided it's about time he watered the garden. The garden c...

卑鄙的我 497

codeforces 152E Garden(状态压缩dp)

题目链接 E. Garden time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has a very beautiful country gard

madaidao的专栏 931
上一篇: Another Problem on Strings CodeForces - 165C
下一篇: How Many Fibs? UVA - 10183 (java)
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值