Codeforces Beta Round #1 A. Theatre Square

codeforces的第一场的第一题,原以为自己肯定一次就ac,结果没想到还wa了

题意:一个n*m的广场要铺地板,每块地板的是a*a的矩形。问最少多少块地板,地板不能打碎,但铺的时候可以超过广场大小(1<=n,m,a<=10^9)

思路:求出广场的每条分别至少需要多少地板,然后相乘,我wa的原因就是,没有考虑到相乘的时候已经超int的范围了。

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <queue>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
typedef unsigned long long UL;
#define MS(x,y) memset(x,y,sizeof(x))
#define rpt(i,l,r) for(int i=l;i<=r;i++)
#define rpd(i,r,l) for(int i=r;i>=l;i--)
LL gcd(LL a,LL b){ return b==0?a:gcd(b,a%b);}
#define N 1000005
int main(){
    LL n,m,a;
    while(scanf("%I64d%I64d%I64d",&n,&m,&a)!=EOF){
        LL x=n/a;
        if(n%a!=0) x++;
        LL y=m/a;
        if(m%a!=0) y++;
        printf("%I64d\n",x*y);
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值