Fried Fish

It is a well-known fact that Rybinsk once used to be a great fishing spot. People who 
lived in this town had fish for breakfast, lunch, and dinner. And whatever they could 
not eat themselves, they shipped to other towns and cities. Therefore, optimizing the 
fish cooking process was an important task. 
Let us assume that today we caught N fish of the same size. Our frying pan fit up to 
K fish. Another assumption is that each side of each fish has to be fried for one 
minute. As a reminder, fish is usually fried on two sides.
And now let us count the minimum time we need to fry all the fish we have.
Limitations
1 ≤ N, K ≤ 500
Input
The input file contains two integer numbers N and K – the number of fish caught and 
the number of fish that can fit into our frying pan.
Output
The output file must contain one integer number – the minimum time (minutes) 
needed to fry all the fish.
Examples
Input.txt Output.txt
3 2 3

4 2 4


题意:渔民煎鱼,有n条鱼,有一个锅一次能煎k条鱼,一条鱼两面全煎,煎一面需要1分钟,问将全部鱼煎完最少需要多少时间


思路:

1.最少需要两分钟

2.思路就是每次肯定都将锅放满,所以直接按总面数算就可以了


ac代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int x,y;
    while(scanf("%d%d",&x,&y)!=-1)
    {
        if(2*x<=y)
        printf("2\n");
        else
        {
            if((2*x)%y==0)
            printf("%d\n",(2*x)/y);
            else
            printf("%d\n",(2*x)/y+1);
        }
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值