Codeforces 449A Jzzhu and Chocolate(贪心)
来源:互联网 发布:北京清退 知乎 编辑:程序博客网 时间:2024/05/20 09:10
题目链接: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;}
0 0
- Codeforces 449A Jzzhu and Chocolate(贪心)
- CodeForces 449A - Jzzhu and Chocolate(贪心)
- 449A - Jzzhu and Chocolate 贪心
- 【杂题】 codeforces 449A Jzzhu and Chocolate
- CodeForces 449-A. Jzzhu and Chocolate
- CodeForces 449A Jzzhu and Chocolate
- Codeforces 449 A Jzzhu and Chocolate
- CodeForces 449A - Jzzhu and Chocolate
- Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪心、数学)
- CODEFORCES 450C Jzzhu and Chocolate <贪心>
- Codeforces Round #257 (Div. 2)449A - Jzzhu and Chocolate
- CodeForces 449 A.Jzzhu and Chocolate(枚举)
- Codeforces Jzzhu and Chocolate
- Jzzhu and Chocolate - CF 449C 贪心
- CF Problem 449A Jzzhu and Chocolate
- CF Codeforces Round #257 (Div. 1) A (449A) Jzzhu and Chocolate
- Codeforces 450 C. Jzzhu and Chocolate
- Codeforces 450 C. Jzzhu and Chocolate
- Debug和Release区别
- 小故事,大道理
- 关于nextkey锁
- ViewPager使用控件问题
- Android 内核安全机制-selinux简介
- Codeforces 449A Jzzhu and Chocolate(贪心)
- phpcms在导航随意调用一个栏目下的子栏目
- java提高篇(三)-----理解java的三大特性之多态
- sencha touch 环境配置
- 音乐节拍提取(一)
- linux 下配置静态Ip
- 页面直接的跳转问题
- 关于ubuntu 12.04 中文环境的相关设置
- 程序员网站