题目链接:

space=1&num=1820" target="_blank">http://acm.timus.ru/problem.aspx?

space=1&num=1820

1820. Ural Steaks

Time limit: 0.5 second

Memory limit: 64 MB
After the personal contest, happy but hungry programmers dropped into the restaurant “Ural Steaks” and ordered n specialty steaks. Each steak is cooked by frying each of its sides on a frying
pan for one minute.
Unfortunately, the chef has only one frying pan, on which at most k steaks can be cooked simultaneously. Find the time the chef needs to cook the steaks.

Input

The only input line contains the integers n and k separated with a space (1 ≤ nk ≤ 1000).

Output

Output the minimal number of minutes in which the chef can cook n steaks.

Sample

input output
3 2
3

PS:

选择尽快先炸掉每块牛排的当中一个面!

对于案例:

第一步:a1, b1;

第二步:c1, a2;

第三步:b2, c2;

代码例如以下:

#include <cstdio>
#include <cstring> int main()
{
int n, k;
while(~scanf("%d%d",&n,&k))
{
if(n < k)
{
printf("2\n");
continue;
}
int tt = (2*n)%k;
int ans = 2*n/k;
if(tt)
{
ans+=1;
}
printf("%d\n",ans);
}
return 0;
}

URAL 1820. Ural Steaks(数学啊 )的更多相关文章

  1. URAL 1161 Stripies(数学+贪心)

    Our chemical biologists have invented a new very useful form of life called stripies (in fact, they ...

  2. URAL 2047 Maths (数学)

    对于一个数来说,它的除数是确定的,那么它的前驱也是确定的,而起点只能是1或2,所以只要类似筛法先预处理出每个数的除数个数 ,然后递推出每个数往前的延伸的链长,更新最大长度,记录对应数字.找到maxn以 ...

  3. URAL 1731. Dill(数学啊 )

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1731 1731. Dill Time limit: 0.5 second Memory ...

  4. URAL 1826. Minefield(数学 递归)

    题目链接:http://acm.timus.ru/problem.aspx? space=1&num=1826 1826. Minefield Time limit: 0.5 second M ...

  5. ACM比赛技巧

    一.语言是最重要的基本功   无论侧重于什么方面,只要是通过计算机程序去最终实现的竞赛,语言都是大家要过的第一道关.亚洲赛区的比赛支持的语言包括C/C++与JAVA.笔者首先说说JAVA,众所周知,作 ...

  6. Android时区及语言代码

    1. 设置默认时区   PRODUCT_PROPERTY_OVERRIDES += \         persist.sys.timezone=Asia/Shanghai\ 注:搜索“persist ...

  7. 我的Android进阶之旅------>Android 设置默认语言、默认时区

    1. 设置默认时区 PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.timezone=Asia/Shanghai\ 注:搜索“persist.sys.timez ...

  8. 程序猿常识--OJ系统和ACM测试考试大全

    OJ它是Online Judge缩写系统,来在线检測程序源码的正确性. 著名的OJ有RQNOJ.URAL等. 国内著名的题库有北京大学题库.浙江大学题库等. 国外的题库包含乌拉尔大学.瓦拉杜利德大学题 ...

  9. Android系统移植与调试之------->如何修改Android的默认语言、默认时区

    修改device/other/TBDG1073/ system.prop文件 1.设置默认语言 找到device/other/TBDG1073/ system.prop文件,修改属性ro.produc ...

随机推荐

  1. [置顶] java 枚举

    1. 什么是枚举?枚举就是用来存放一组固定的常量. 2. 枚举有什么作用?一些程序在运行时,它需要的数据不能是任意的,而必须是一定范围内的值:例如性别  男和女. public enum Gender ...

  2. Effective C++ 第二版 10) 写operator delete

    条款10 写了operator new就要同时写operator delete 写operator new和operator delete是为了提高效率; default的operator new和o ...

  3. 【企业库6】【日志应用程序块】实验2:创建和使用异步Trace Listener

    Lab 2: Create and Use an Asynchronous Trace Listener 实验2:创建和使用异步Trace Listener In this lab, you will ...

  4. Extending your SharePoint 2007 site with Microsoft ASP.NET AJAX 3.5

    After ASP.NET 3.5 has been installed you need to modify the web.config file of your MOSS web site wi ...

  5. bulk insert data into database with table type .net

    1. Create Table type in Sqlserver2008. CREATE TYPE dbo.WordTable as table ( [WordText] [nchar]() NUL ...

  6. BlokUI的使用

    1.点击弹出层以外的区域关闭弹出层 $(document).ready(function() {     $('#demo9').click(function() {         $.blockU ...

  7. [html5] canvas 绘图:八卦图

    <!DOCTYPE HTML> <html> <head> <meta charset="utf-8" /> <title&g ...

  8. JavaSE学习总结第07天_面向对象2

      07.01 成员变量和局部变量的区别 1.在类中的位置不同 成员变量    类中方法外 局部变量    方法内或者方法声明上 2.在内存中的位置不同 成员变量   堆内存 局部变量   栈内存 3 ...

  9. BZOJ 3304: [Shoi2005]带限制的最长公共子序列( LCS )

    求个LCS, 只是有了限制, 多加一维表示匹配到z串的第几个, 然后用滚动数组 ------------------------------------------------------------ ...

  10. json在PHP中应用技巧

    一.json_encode() 该函数主要用来将数组和对象,转换为json格式.先看一个数组转换的例子: $arr = array ('a'=>1,'b'=>2,'c'=>3,'d' ...