"codeforces--NEFU要崛起——第1场 " A - Theatre Square
来源:互联网 发布:bbi买卖指标源码 编辑:程序博客网 时间:2024/05/17 05:16
Description
Theatre Square in the capital city of Berland has a rectangular shape with the sizen × 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 sizea × 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.
Sample Input
6 6 4
4
题意:告诉长和宽 然后一个变长为a的正方形 问需要多少块儿才能全部覆盖前面长宽相乘所得出的面积(必须完全覆盖)
题解:我勒个去 我捣鼓了快一个小时才知道_int64很神奇
代码:
#include<iostream>#include<cstring>#include<cstdio>using namespace std;__int64 num(__int64 x,__int64 y){__int64 num1=x/y;if(x%y!=0) num1=num1+1; return num1;}int main(){__int64 m,n,a;while(cin>>m>>n>>a){ __int64 q=num(m,a); __int64 w=num(n,a); cout<<q*w<<endl; }return 0;}
还有一个一直超时的代码 不知道为什么改了成_int64也没用~
开始的时候错误代码:
#include<iostream>#include<cstring>#include<cstdio>using namespace std;int num(int length,int sl){ __int64 k=0;for(int i=1;i<=length;i++){if(length>sl*i){k=i;}if(length<=sl*i){ break;} }return k+1;}int main(){__int64 l;__int64 w;__int64 sl;__int64 mainji;__int64 a,b;__int64 tatol;while(scanf( "%d%d%d", &l, &w, &sl )!=EOF){a=num(l,sl);b=num(w,sl);tatol=a*b;printf("%d%\n", tatol);//cout<<tatol<<endl;}return 0;}
- "codeforces--NEFU要崛起——第1场 " A - Theatre Square
- NEFU要崛起——第1场 A - Theatre Square
- NEFU要崛起——第3场 A - Watermelon
- NEFU要崛起——第3场 A - Watermelon
- NEFU要崛起——第16场 A - Triangle
- NEFU要崛起——第17场 A
- codeforces--NEFU要崛起——第1场 " B - Winne
- codeforces——1A - Theatre Square
- NEFU要崛起——第1场
- NEFU要崛起——第2场 A - Shortest path of the king
- NEFU要崛起——第2场 A - Shortest path of the king
- NEFU要崛起——第4场 A - Chat Server's Outgoing Traffic
- NEFU要崛起——第17场 A-Word Cup
- NEFU要崛起——第2场
- NEFU要崛起——第3场
- NEFU要崛起——第4场
- NEFU要崛起——第5场
- NEFU要崛起——第6场
- android概览
- MySQL Replication和Oracle logical standby的原理对比
- linux内核部件分析(五)——设备驱动模型的基石kobject
- Reading Note 1127
- Linux 管道(pipe)
- "codeforces--NEFU要崛起——第1场 " A - Theatre Square
- linux内核部件分析(六)——设备驱动模型之device
- android 使用javamail收发邮件
- 常见全网链接查询工具地址
- linux内核部件分析(七)——设备驱动模型之driver
- 用批处理命令编译java文件
- linux内核部件分析(八)——设备驱动模型之bus
- [Boost基础]VS2008/VS2010安装配置Boost1.50开发环境
- drupal 文件夹说明