1. 程式人生 > >【2015-2016 ACM-ICPC, NEERC, Southern Subregional Contest B】【暴力雙排序】Layer Cake 若干矩形 選擇相同長和寬的最大體積

【2015-2016 ACM-ICPC, NEERC, Southern Subregional Contest B】【暴力雙排序】Layer Cake 若干矩形 選擇相同長和寬的最大體積

Dasha decided to bake a big and tasty layer cake. In order to do that she went shopping and boughtnrectangular cake layers. The length and the width of thei-th cake layer wereaiandbirespectively, while the height of each cake layer was equal to one.

From a cooking book Dasha learned that a cake must have a form of a rectangular parallelepiped constructed from cake layers of the same sizes.

Dasha decided to bake the biggest possible cake from the bought cake layers (possibly, using only some of them). It means that she wants the volume of the cake to be as big as possible. To reach this goal, Dasha can cut rectangular pieces out of the bought cake layers. She always cuts cake layers in such a way that cutting lines are parallel to the edges of that cake layer. Dasha isn't very good at geometry, so after cutting out a piece from the original cake layer,she throws away

the remaining part of it. Alsoshe can rotatea cake layer in the horizontal plane (swap its width and length).

Dasha wants her cake to be constructed as a stack of cake layers of the same sizes. Each layer of the resulting cake should be made out of only one cake layer (the original one or cut out from the original cake layer).

Help Dasha to calculate the maximum possible volume of the cake she can bake using given cake layers.

相關推薦

2015-2016 ACM-ICPC, NEERC, Southern Subregional Contest B暴力排序Layer Cake 若干矩形 選擇相同體積

Dasha decided to bake a big and tasty layer cake. In order to do that she went shopping and boughtnrectangular cake layers. The length and the width of t

2015-2016 ACM-ICPC, NEERC, Moscow Subregional Contest A題:Anagrams [打表/規律題]

題意:給出一個進位制B ,有一數字K,K的所有倍數,記為Xi , 對於Xi 在B進位制下長度相等的所有數,記為Yi , 若都能被K整除,則這個K叫做B-stable,求所有B-stable; 範圍:N<=20億 解法:觀察資料,發現有一定規律,打表發現所有數都是B-1

Codeforces 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror)

人生的第一次ACM啊(雖然是映象)… 先來一張臨時組建隊伍GZC的合影: 開始的時候Chongkan迷之手氣直接抽H,敲掉了最水的一道題(各種WA),於是從一臉懵逼的蒟蒻我手中接過了A題,說些什麼我聽不懂的東西,然後就去敲了… [Kanosword

D. Dog Show 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest, qualification stage (Online Mirror, ACM-ICPC Rules, Teams Preferred)

cto long space 。。 urn ext team south cpc http://codeforces.com/contest/847/problem/D 巧妙的貪心 仔細琢磨。。。 像凸包裏的處理 1 #include <cstdio>

#dp# 2018-2019 ACM-ICPC, NEERC, Southern Subregional Contest, Qualification Stage

K. Medians and Partition Description: 將一組數恰好分割成多組數,對每組數進行排序後,使得每組數的中位數大於等於m,求解最多可以分成多少組數 Solution: ok[i][j]: 在 [i, j] 這段區間裡的中位數是否符合要求,即

2014-2015 ACM-ICPC, NEERC, Moscow Subregional Contest B - Bring Your Own Bombs 離散化+掃描線+計算期望

lower 細節 main fin cto spa nal chan acm-icpc 掃描線一邊掃一邊算期望,細節比較多。 #include<bits/stdc++.h> #define LL long long #define fi first

100109F 2012-2013 ACM-ICPC, NEERC, Southern Subregional Contest F

直接暴力 限定每種質量物品個數然後求價值前k大的質量 #include<bits/stdc++.h> using namespace std; #define N 4005 #define

2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div 1)Afloyd 小路徑覆蓋最少飛機數滿足所有航班要求

#include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math

2017-2018 ACM-ICPC, NEERC, Moscow Subregional Contest B - Byteland Trip dp

B - Byteland Trip 題目大意:給你一個由'<' 和 '>'組成的串, 如果在'<' 只能前往編號比它小的任意點, 反之只能前往比它大的任意點,問你能遍歷所有點 並且每個點只走一次終點在各個位置的方案數。 思路:感覺這種右能從左邊跑到右邊又跑回來的dp很難搞,如果我們確定

2018-2019 ICPC, NEERC, Southern Subregional Contest B - Berkomnadzor [contest/1070]

B - Berkomnadzor [contest/1070] 題面 思路 考慮二進位制,遮蔽只是不影響後 32 −

*20002018-2019 ICPC, NEERC, Southern Subregional Contest C Cloud Computing

【連結】 我是連結,點我呀:) 【題意】 【題解】 我們可以很容易知道區間的每個位置有哪些安排可以用。 顯然 我們優先用那些花費的錢比較少的租用cpu方案。 但一個方案可供租用的cpu有限。 我們可以用一個線段樹 線段樹的下標表示價格。 那一位的值,為這個價格的cpu能租多少個。 弄

2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred)

  A. Find a Number   找到一個樹,可以被d整除,且數字和為s   記憶化搜尋   1 static class S{ 2 int mod,s; 3 String str; 4 5

2015-2016 ACM-ICPC Northeastern European Regional Contest (NEERC 15)C - Cactus Jubilee

inf spa type ase reg ace ubi scan stdout 題意:給一顆仙人掌,要求移動一條邊,不能放在原處,移動之後還是一顆仙人掌的方案數(仙人掌:無向圖,每條邊只在一個環中),等價於先刪除一條邊,然後加一條邊 題解:對於一顆仙人掌,分成兩種邊,1:

10月20日 訓練記錄 2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Team

A題 題意:求數位總和為s且是d的倍數的最小值,若無解輸出-1 思路:s<=5000,d<=500說明狀態數<=s*d=5000*500,bfs搜尋 程式碼: #include<bits/stdc++.h> using namespace

2016-2017 ACM-ICPC, NEERC, Northern Subregional Contest G

題目大意 現有一顆有根樹,葉子節點可被染成黑色(最開始都是白色),也可以被染回白色,現在問給出每次染色資訊後(即帶修改),最少需要切斷幾條邊保證黑色葉子不在樹上,且在此條件下最少有多少白色葉子不在樹上。 解題思路 大體演算法:DFS序+倍增 很容易發現,

2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror) Partial Solution

從這裡開始 題目列表 瞎扯 Problem A Find a Number Problem B Berkomnadzor Problem C Cloud Computing Problem D Garbage Disp

codeforces 1070I 2018-2019 ICPC,NEERC,Southern Subregional Contest Privatization of Roads in Berlan

題面 題意 給出一張無向圖,現在要對上面的邊進行染色(可以認為有無數種顏色),並且每種邊只能染一種顏色,每種顏色最多隻能染兩條邊,並且與每個點相連的邊最多隻有k種顏色,請輸出一種方案。 做法 首先如果存在一個度數大於

2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror) 體驗記

  原文連結https://www.cnblogs.com/zhouzhendong/p/CF1070.html 比賽網址:http://codeforces.com/contest/1070 感受   本來只打算玩玩的。   結果玩的海星。   我做 A 題的時候可能比較浮躁吧,各種傻

2017-2018 ACM-ICPC, NEERC, Moscow Subregional Contest

leak infinite odin clas rep nal history play com 地址 Rank Solved A B C D E F G H I J 51/298 6/10 O . O O . . O O O . O: 當場通過 ?: