日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Codeforces Gym 100269G Garage 数学

發布時間:2024/1/17 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Gym 100269G Garage 数学 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Garage

題目連接:

http://codeforces.com/gym/100269/attachments

Description

Wow! What a lucky day! Your company has just won a social contract for building a garage complex.
Almost all formalities are done: contract payment is already transferred to your account.
So now it is the right time to read the contract. Okay, there is a sandlot in the form of W × H rectangle
and you have to place some garages there. Garages are w × h rectangles and their edges must be parallel
to the corresponding edges of the sandlot (you may not rotate garages, even by 90?
). The coordinates of
garages may be non-integer.
You know that the economy must be economical, so you decided to place as few garages as possible.
Unfortunately, there is an opposite requirement in the contract: placing maximum possible number of
garages.
Now let’s see how these requirements are checked. . . The plan is accepted if it is impossible to add a new
garage without moving the other garages (the new garage must also have edges parallel to corresponding
sandlot edges).
Accepted optimal plan Rejected plan Accepted, but non-optimal plan
Time is money, find the minimal number of garages that must be ordered, so that you can place them
on the sandlot and there is no place for an extra garage.

Input

The only line contains four integers: W, H, w, h — dimensions of sandlot and garage in meters. You may
assume that 1 ≤ w ≤ W ≤ 30 000 and 1 ≤ h ≤ H ≤ 30 000.

Output

Output the optimal number of garages.

Sample Input

15 7 4 2

Sample Output

4

Hint

題意

現在給你一個矩形,W*H的,然后問你最少個w*h的小矩形

題解:

想一想

一個小矩形最多可以占據2*w*2*h的空間嘛

然后我們直接暴力算就好了,注意最后如果還有空位的話,就直接放一個進去就好了

代碼

#include<bits/stdc++.h> using namespace std;int main() {freopen("garage.in","r",stdin);freopen("garage.out","w",stdout);long long W,H,w,h;cin>>W>>H>>w>>h;long long L,R,l,r;L = W/w/2+W/w%2;R = H/h/2+H/h%2;cout<<L*R<<endl; }

轉載于:https://www.cnblogs.com/qscqesze/p/5199553.html

總結

以上是生活随笔為你收集整理的Codeforces Gym 100269G Garage 数学的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。