网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月11日漏签0天
codeforces吧 关注:2,028贴子:2,128
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回codeforces吧
>0< 加载中...

【求助】codeforces 1A Running Time Error

  • 只看楼主
  • 收藏

  • 回复
  • lucy豆豆bean
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
题目
Theatre Square in the capital city of Berland has a rectangular shape with the size n×m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a×a.
What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.
Input
The input contains three positive integer numbers in the first line: n,m and a (1≤n,m,a≤109).
Output
Write the needed number of flagstones.
Examples
input
6 6 4
output
4
#include<stdio.h>#include<iostream>#include<algorithm>
using namespace std;
int main(){
int n,m,a;
long long ans;
cin>>n,m,a;
ans=(n/a+1)*(m/a+1);
cout<<ans; return 0;
}


  • djq_2005
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
虽然输入都在int范围内但是(n/a+1)*(n/b+1)的中间结果可能会爆int
把第一个(n/a+1)改成(long long)(n/a+1)试试


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回codeforces吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示