题目链接:Codeforces 449A Jzzhu and Chocolate
题目大意:给定一个n∗m的巧克力,问说切k刀之后,使得说最小的一份面积最大。
解题思路:贪心,尽量切一个方向,比较一下两种的最优解。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n, m, k;
ll gao (ll x, ll y) {
ll a = n / (x + 1);
a = min(a, n - a * x);
ll b = m / (y + 1);
b = min(b, m - b * y);
return a * b;
}
ll solve () {
if (n + m - 2 < k)
return -1;
ll x = max(k - n + 1, 0LL);
ll y = max(k - m + 1, 0LL);
return max(gao(k - x, x), gao(y, k - y));
}
int main () {
scanf("%lld%lld%lld", &n, &m, &k);
printf("%lld\n", solve());
return 0;
}
分享到:
相关推荐
Codeforces 185A - Plant 全测试点49个
jzzhu and cities problem realisation
暴枚最长桌脚的长度$l$,然后长度比$l$长的桌脚全部都要砍掉长度比$l$短的桌脚选择代价前$k$小的砍掉用线段树维护;示例程序 :typedef long l
Codeforces - 1131C. Birthday(贪心)题目链接题目给你n和n个数,要你重新排列n个数,使得这些数的相邻差值中最大的那个值最小。stat
Codeforces 题库 101-200 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
Codeforces 题库 001-100 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
codeforces编程网站预测分数插件
Codeforces 1105B - Zuhair and Strings 测试点37个(全)
使用于Google Chrome的Codeforces Enhancer 1.1.2插件安装包。 版本:codeforces enhancer 1.1.2 使用浏览器:Google Chrome
codeforces 19 E Fairy 一道比较难的题目的解题报告 推荐阅读
题目大意:给出 n 个数字组成的序列,现在可以对数列进行多次操作,每次操作可以选择其中一段连续的数列,用其平均数替换原位置,换句话说,若原连续数列为 1 2 3,则可以替换为 2 2 2,问如何操作可以使得最后答案...
Codeforces global round 10 codes
codeforces每日一练。 题意: 给一棵树,每个点有一个点权,每条边有一个边权,求一条链使得点权和-边权和最大。 思路: 由于我没看清楚题意,以为是求联通子图的点权和-边权和最大,用link-cut-tree写换根,wa10了两...
Codeforces round 678 division 2 codes
Some of the Codeforces problems codes
codeforces每日一题。 题意: 给出一个数组,让你挑选出能组成任意pair差值为2的幂的序列,并且使这个序列长度尽可能大。 思路: 针对于挑选出来的序列,任意pair对的差值为2的幂数。 假设有多个pair对,设dis(a,b)=2...
Codeforces部门2,A # And a2oj Ladder 4 some problems Ladder URL:http://a2oj.com/Ladder.jsp?ID=4难度等级:2问题提示: 1- 4A. Watermelon: http://codeforces.com/problemset/problem/4/A 2- 71A. Way Too ...
lucifer1004大佬的博客cf上分攻略故里大佬的githubcf思维题刷题数:44- (1421)codeforces 676 div2 A,B done
Codeforces - 1107B. Digital root & 1107C. Brutality(规律 & 贪心)Codeforces - 1107B.
Codeforces round 678 D2_Codeforces_源码