题目地址:http://codeforces.com/contest/448/problem/D

当时是依照找规律做的,规律倒是找出来了,可是非常麻烦非常麻烦。

看到前几名的红名爷们3分钟就过了,于是果断放弃了。

。赛后才知道是用二分的方法做,知道了二分之后。剩下的就非常easy了。。关键在于能不能想到用二分。。

代码例如以下:

#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 low, high, mid, x, ans, s1, s2, n, m, k, i;
scanf("%I64d%I64d%I64d",&n,&m,&k);
high=n*m;
low=1;
while(low<=high)
{
mid=(low+high)/2;
s1=s2=0;
for(i=1;i<=n;i++)
{
x=mid/i;
if(x>m)
{
s1+=m;
}
else
{
if(mid%i==0)
{
s2++;
s1+=x-1;
}
else
{
s1+=x;
}
}
}
if(k>=s1+1&&k<=s1+s2)
{
ans=mid;
break;
}
else if(k>s1+s2)
{
low=mid+1;
}
else
{
high=mid-1;
}
}
printf("%I64d\n",ans);
return 0;
}

codeforces#256DIV2 D题Multiplication Table的更多相关文章

  1. Codeforces Codeforces Round #319 (Div. 2) A. Multiplication Table 水题

    A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/57 ...

  2. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  3. Codeforces 448 D. Multiplication Table 二分

    题目链接:D. Multiplication Table 题意: 给出N×M的乘法矩阵要你求在这个惩罚矩阵中第k个小的元素(1 ≤ n, m ≤ 5·10^5; 1 ≤ k ≤ n·m). 题解: n ...

  4. Codeforces Round #586 (Div. 1 + Div. 2) B. Multiplication Table

    链接: https://codeforces.com/contest/1220/problem/B 题意: Sasha grew up and went to first grade. To cele ...

  5. Codeforces Round #256 (Div. 2) D. Multiplication Table 二分法

     D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input st ...

  6. Codeforces 448 D. Multiplication Table

    二分法判断答案 D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes inp ...

  7. Codeforces Round #256 (Div. 2) D. Multiplication Table 很有想法的一个二分

    D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input stand ...

  8. Day8 - D - Multiplication Table CodeForces - 448D

    Bizon the Champion isn't just charming, he also is very smart. While some of us were learning the mu ...

  9. hdu4951 Multiplication table (乘法表的奥秘)

    http://acm.hdu.edu.cn/showproblem.php?pid=4951 2014多校 第八题 1008 2014 Multi-University Training Contes ...

随机推荐

  1. Qt的setMouseTracking使用

    bool mouseTracking 这个属性保存的是窗口部件跟踪鼠标是否生效. 如果鼠标跟踪失效(默认),当鼠标被移动的时候只有在至少一个鼠标按键被按下时,这个窗口部件才会接收鼠标移动事件. 如果鼠 ...

  2. new对象数组时的内存布局

    #include <iostream> #include <limits> using namespace std; #define SAFE_DELETE(x) \ { \ ...

  3. zoj1028-Flip and Shift

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=28 题意:有相互交叉的黑白两种颜色的小球,每一个小球每次可以跳两格:问你是否可以 ...

  4. PHP移动互联网开发笔记(5)——文件的上传下载

    原文地址:http://www.php100.com/html/php/rumen/2014/0326/6706.html 一.文件的上传 1.client设置: (1).在 标签中将enctype和 ...

  5. Android开发:在onTouchEvent中处理任意时间的长按事件

    Android提供了GestureDetector类来处理一些常用的手势操作,比如说 onLongPress,onFling 等.但这里不使用GestureDetector,而是直接在自定义View重 ...

  6. 出现Data Tools 与VS 不兼容问题

    转载自:http://www.yishimei.cn/network/73.html 相信很多人都遇到了“此版本的SQL Server Data Tools与此计算机中安装的数据库运行时组件不兼容”这 ...

  7. Entity - 使用EF框架进行增删改查 - 数据库先行

    数据库先行:先创建数据库,然后进行增删查该操作. 要操作的表结构(表名:Tb_Category): 创建一个控制台程序: 添加一个ADO.NET实体数据模型: 1.对控制台程序右键 2.选择ADO.N ...

  8. UML之九图概述

    最近看了UML的九种图的讲解,这九种图在我们以后的学习中起着举足轻重的作用,不管是在写文档,还是在对系统的需求.设计进行分析时,都很重要,所以首先做一下概述,希望能和大家分享. 首先和大家展示一下我对 ...

  9. Oracle左连接、右连接示例

    建表: create table a ( id ), name ) ); create table b ( name ), age ) ); create table c ( name ), dept ...

  10. activemq java版本要求

    <pre name="code" class="html">activemq: redis01:/root# cp apache-activemq- ...