博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Educational Codeforces Round 50 [Rated for Div. 2] A. Function Height
阅读量:5021 次
发布时间:2019-06-12

本文共 2721 字,大约阅读时间需要 9 分钟。

A. Function Height

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given a set of 2n+12n+1 integer points on a Cartesian plane. Points are numbered from 00 to 2n2n inclusive. Let PiPi be the ii-th point. The xx-coordinate of the point PiPi equals ii. The yy-coordinate of the point PiPi equals zero (initially). Thus, initially Pi=(i,0)Pi=(i,0).

The given points are vertices of a plot of a piecewise function. The jj-th piece of the function is the segment PjPj+1PjPj+1.

In one move you can increase the yy-coordinate of any point with odd xx-coordinate (i.e. such points are P1,P3,…,P2n−1P1,P3,…,P2n−1) by 11. Note that the corresponding segments also change.

For example, the following plot shows a function for n=3n=3 (i.e. number of points is 2⋅3+1=72⋅3+1=7) in which we increased the yy-coordinate of the point P1P1 three times and yy-coordinate of the point P5P5 one time:

Let the area of the plot be the area below this plot and above the coordinate axis OX. For example, the area of the plot on the picture above is 4 (the light blue area on the picture above is the area of the plot drawn on it).

Let the height of the plot be the maximum yy-coordinate among all initial points in the plot (i.e. points P0,P1,…,P2nP0,P1,…,P2n). The height of the plot on the picture above is 3.

Your problem is to say which minimum possible height can have the plot consisting of 2n+12n+1 vertices and having an area equal to kk. Note that it is unnecessary to minimize the number of moves.

It is easy to see that any answer which can be obtained by performing moves described above always exists and is an integer number not exceeding 10181018.

Input

The first line of the input contains two integers nn and kk (1≤n,k≤10181≤n,k≤1018) — the number of vertices in a plot of a piecewise function and the area we need to obtain.

Output

Print one integer — the minimum possible height of a plot consisting of 2n+12n+1 vertices and with an area equals kk. It is easy to see that any answer which can be obtained by performing moves described above always exists and is an integer number not exceeding 10181018.

Examples

input

Copy

4 3

output

Copy

1

input

Copy

4 12

output

Copy

3

input

Copy

999999999999999999 999999999999999986

output

Copy

1

Note

One of the possible answers to the first example:

The area of this plot is 3, the height of this plot is 1.

There is only one possible answer to the second example:

The area of this plot is 12, the height of this plot is 3.

 

#include
using namespace std;typedef long long LL;int main(){ LL n,m,j,k,i,T; while (cin>>n>>k) { if (k<=n) cout<<"1"<

 

转载于:https://www.cnblogs.com/Romantic-Chopin/p/10253108.html

你可能感兴趣的文章
第一次独立上手多线程高并发的项目的心路历程
查看>>
ServiceStack 介绍
查看>>
Centos7下载和安装教程
查看>>
无谓的通宵加班之后的思索
查看>>
S1的小成果:MyKTV系统
查看>>
从setting文件导包
查看>>
编写一个函数isMerge,判断一个字符串str是否可以由其他两个字符串part1和part2“组合”而成...
查看>>
union和union all
查看>>
Github 开源:使用控制器操作 WinForm/WPF 控件( Sheng.Winform.Controls.Controller)
查看>>
PMD使用提醒
查看>>
Codeforces 887D Ratings and Reality Shows
查看>>
论文《A Generative Entity-Mention Model for Linking Entities with Knowledge Base》
查看>>
CentOS 6.7编译安装PHP 5.6
查看>>
Linux记录-salt分析
查看>>
Android Studio默认快捷键
查看>>
发布开源库到JCenter所遇到的一些问题记录
查看>>
第七周作业
查看>>
函数式编程与参数
查看>>
flush caches
查看>>
SSAS使用MDX生成脱机的多维数据集CUB文件
查看>>