标签:style ar os sp div on art amp as
长为H的格子里面放n个长为h的格子 最多会有n+1个空隙
要使每一个空隙长度都小于h (H-h*n)/(n+1)<h
n>(H/h-1)/2
#include<bits/stdc++.h> int main() { int W,H,w,h; while(scanf("%d%d%d%d",&W,&H,&w,&h)==4) { int x=(int)ceil((W*1.0/w-1)/2),y=(int)ceil((H*1.0/h-1)/2); if(W%w==0&&(W/w)%2==1) x++; if(H%h==0&&(H/h)%2==1) y++; printf("%d\n",x*y); } return 0; }
标签:style ar os sp div on art amp as
原文地址:http://www.cnblogs.com/lcchuguo/p/4091869.html