职务地址:http://codeforces.com/contest/450/problem/C

这次CF的时候绝壁脑残了。

。。A题和C题都出现了脑残失误。。。

唯一一个AC的B题还是被HACK了。。。分数也不多了。。。简直sad。

。。。。。

这题我的思路是分类讨论。分四种情况。

首先让n>=m,假设不是的话,能够交换。主要是考虑切横的多少刀,竖的多少刀。

1:当k>n+m-2,此时,切不了那么多刀。输出-1.

2:当k>=n,此时。把长的那一段全切了,剩下的切短的。

3:当k<n&&k>=m,此时,全切长的,短的不切。

4:当k<m时。我当时懒得分析怎么切。。直接也是切一边,于是就直接来了个比較取大的。

这样分类完。

。就非常清晰了。

代码也非常easy了。

。可我当时竟然对第二个分类直接输出了1。。

。sad。

。当时大脑绝壁短路了。。。

代码例如以下:

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include<algorithm> using namespace std; int main()
{
__int64 n, m, k, i, x1=-1, x2=-1, x;
scanf("%I64d%I64d%I64d",&n,&m,&k);
if(n<m)
{
int t=n;
n=m;m=t;
}
if(n+m-2<k)
printf("-1\n");
else if(k>=n)
{
printf("%d\n",m/(k-n+2));
}
else if(k<n&&k>=m)
{
printf("%I64d\n",n/(k+1)*m);
}
else
printf("%I64d\n",max(m/(k+1)*n,n/(k+1)*m));
return 0;
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

codeforces #257 C称号Jzzhu and Chocolate的更多相关文章

  1. Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪婪、数学)

    主题链接:http://codeforces.com/problemset/problem/449/A ------------------------------------------------ ...

  2. Codeforces Round #257 (Div. 2) C. Jzzhu and Chocolate

    C. Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standa ...

  3. Codeforces 450C:Jzzhu and Chocolate(贪心)

    C. Jzzhu and Chocolate time limit per test: 1 seconds memory limit per test: 256 megabytes input: st ...

  4. cf 450c Jzzhu and Chocolate

    Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. codeforces 450C. Jzzhu and Chocolate 解题报告(449A)

    题目链接:http://codeforces.com/contest/450/problem/C 题目意思:给出一个 n * m 大小的chocolate bar,你需要在这个bar上切 k 刀,使得 ...

  6. codeforces C. Jzzhu and Chocolate

    http://codeforces.com/contest/450/problem/C 题意:一个n×m的矩形,然后可以通过横着切竖着切,求切完k次之后最小矩形面积的最大值. 思路:设k1为横着切的次 ...

  7. Codeforces 450 C. Jzzhu and Chocolate

    //area=(n*m)/ ((x+1)*(k-x+1)) //1: x==0; //2: x=n-1 //3: x=m-1 # include <stdio.h> long long m ...

  8. 【Codeforces 449A】Jzzhu and Chocolate

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 设最后行分成了x行,列分成了y列. 那么答案就是floor(n/x)floor(n/y) 然后x+y-2=k //即平均分配x行.y列 我们可 ...

  9. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

随机推荐

  1. 【SSH2(理论+实践)】--Hibernate步步(一个)

    前几个博客讨论SSH2该框架Struts,它代表层,集成封装.和使用WebWork作为核心处理,依赖映射是它的处理核心.在使用时需要Struts.xml配置相应Action和Interceptor够完 ...

  2. VS2013上利用InstallShield2013LimitedEdition/C#生成安装包

    1.文件-新建项目-其它项目类型-安装和部署 一開始是没有InstallShield2013LimitedEdition这个软件的.你须要去站点上填写信息而且下载 2.填写信息下载 訪问站点:http ...

  3. vs2010中文简体版下载链接(含中文msdn)

    昨天朋友说vs2010中文版能够下载了,自己開始还不相信,正好周末,于是就下载了试一下 安装了果然是中文版,本来是msdn订阅用户才干够下载的,感谢上传的网友. 文件名称 cn_visual_stud ...

  4. Zend_Db_Table::getDefaultAdapter is not working

    在Bootstrap中使用 $url = constant ( "APPLICATION_PATH" ) . DIRECTORY_SEPARATOR . 'configs' . D ...

  5. mysql及powerdesigner的初次使用

    原文:mysql及powerdesigner的初次使用 MYSQL的下载与安装: 下载与安装指导教程: http://jingyan.baidu.com/article/597035521d5de28 ...

  6. 数据库性能监测工具——SQL Server Profiler

    使用SQL Server Profiler 进行sql监控需要一些设置: 其他的就是进行分析了~ 清除SQL SERVER缓存 常用的方法: DBCC DROPCLEANBUFFERS 从缓冲池中删除 ...

  7. 64位WIN7+oracle11g+plsql

    64位WIN7+oracle11g+plsql安装 Posted on 2015-07-28 22:41 算命大师不算卦 阅读(27) 评论(0) 编辑 收藏 上部转自Oracle 11g R2 fo ...

  8. NSOJ 飞船汇合(经典)

    一支分散的飞船舰队,需要汇合到主舰,但是这种飞船在太空中飞行的耗油与质量没有关系,只与发动机打开的时间有关系,为了节省油量,指挥官通知,汇合途中,多台飞船可以串成串飞行,这样只需启动一台发动机,由于安 ...

  9. kobject_create_and_add

    本文来源于源linux 3.14.3版本号/lib/kobject.c文件 /**  * kobject_create_and_add - 动态地创建kobject结构和寄存器sysfs  *  * ...

  10. django csrf_token生成

    django模板中生成csrf_token的不同方式 系统环境 CENTOS 6.4 python 2.7.6 django 1.7.1 当post提交表单的的时候,是需要 csrf_token的, ...