首页 > 其他 > 详细

codevs——2750 心系南方灾区

时间:2017-07-18 19:17:45      阅读:217      评论:0      收藏:0      [点我收藏+]

2750 心系南方灾区

 

 时间限制: 1 s
 空间限制: 2000 KB
 题目等级 : 青铜 Bronze
 
 
题目描述 Description

现在我国南方正在承受百年不遇的大雪、冻雨灾害。北京市已经开始了面向全体市民的捐款活动,并组织运力,以最快速度将这些救灾物资运送到灾区人民的手中。

  已知救灾物资中有m件大衣(10000<=m<=2000000),一辆卡车一次最多可以运走n件(2000<=n<=10000).请你编写程序计算一下,要将所有的大衣运走,北京市政府最少需要调动多少辆卡车参与运送。

输入描述 Input Description

文件中只有两个整数m、n

输出描述 Output Description

文件中只有一个整数,表示需要的卡车数量。

样例输入 Sample Input

10000 2000

样例输出 Sample Output

5

 

女帝很凶残!!

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,ans;
int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<0||ch>9){if(ch==-) f=-1; ch=getchar();}
    while(ch<=9&&ch>=0){x=x*10+ch-0; ch=getchar();}
    return x*f;
}
int up(int x,int y)
{
    if(x%y==0) return x/y;
    return x/y+1;
}
int main()
{
    n=read(),m=read();
    ans=up(n,m);
    printf("%d",ans);
    return 0;
}

 

codevs——2750 心系南方灾区

原文:http://www.cnblogs.com/z360/p/7202208.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!