zoukankan      html  css  js  c++  java
  • URAL 1820. Ural Steaks(数学啊 )

    题目链接: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
    ");
                continue;
            }
            int tt = (2*n)%k;
            int ans = 2*n/k;
            if(tt)
            {
                ans+=1;
            }
            printf("%d
    ",ans);
        }
        return 0;
    }


  • 相关阅读:
    2020/7/18 JDBC
    2020.8.1
    2020.7.31
    二元泰勒公式
    一元泰勒公式
    极值
    介值定理
    积分上限函数
    积分中值定理
    狄利克雷(Dirichlet)函数
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5192722.html
Copyright © 2011-2022 走看看