Kostya the Sculptor(贪心】的更多相关文章

D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a frien…
Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from w…
Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Z…
Kostya the Sculptor 题目链接:http://codeforces.com/problemset/problem/733/D 贪心 以次小边为第一关键字,最大边为第二关键字,最小边为第三关键字排序,每次只需要找次小边和最大边均相同,最小边最大的两项即可. 因为用Python遇到很多问题,切片操作a[i:j]是左闭右开区间[i,j) 代码如下: n = int(input()) a = [] ans,u,v = 0,-1,-1 for i in range(n): t = [in…
Kostya the Sculptor 这次cf打的又是心累啊,果然我太菜,真的该认真学习,不要随便的浪费时间啦 [题目链接]Kostya the Sculptor &题意: 给你n个长方体,你要使长方体的内切球有体积最大,有两种选择方案 ①只选1个长方体. ②选2个长方体,黏到一起,但这2个长方体黏的那一面必须完全相等.也就是长宽相等. &题解: 1个长方体遍历一遍取最小就好了. 2个的时候要第2短的和第3短的相等,才能合到一起,最小的有可能是2个最小的相加,或者是第2短的那个. 这题比…
D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a frien…
http://codeforces.com/contest/733/problem/D 给定n个长方体,然后每个长方体都能选择任何一个面,去和其他长方体接在一起,也可以自己一个,要求使得新的长方体的最短的那条边最大. 看样例2就知道,因为10.8.7和10.8.2组合后,min =  8,是最大的. 那么怎么做呢? 可以看到,一个长方体,能产生6种不同的摆放方式,然后排序后,排序的时候把a相同的尽可能排在一起,把b相同的尽可能地排在一起.因为这样就能分组了. 把数组分成若干组,相同的组里,a和b…
这题本来  想二分.想了很久很久,解决不了排序和二分的冲突.     用贪心吧.. 题意: 给你n个长方形,让你找出2个或1个长方体,使得他们拼接成的长方体的内接球半径最大(这是要求最短边越大越好)(两个矩形拼接的条件是 他们有一个面完全相同) 输入n,输入第 i个长方体的 三条边长度.最多2个长方体拼接. 输出  不要拼接的"1"和最大能切成内切球的 i  :或者输出要拼接的“2”和这两个长方体的序号 i . 如果 两个长方体的边长分别是 3 2 4,3 2 4  .可以拼接成  6…
题目链接:http://codeforces.com/contest/733/problem/D 题意:给n个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少.最多拼2个,可以不拼. 最大内切圆与最短的边有关系,在读入的时候做只取一个的情况,接下来按照边长从大到小排序,之后按照最大边依次排序,取相邻的两个拼接在一起看看是否更大. #include <bits/stdc++.h> using namespace std; typedef struct S…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a care…