题目地址: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. oracle如何设置show parameter显示隐含参数

    在sqlplus中shwo parameter是显示不了隐藏参数的,需要做一个处理,如下所示:    以SYS用户登录: C:\Documents and Settings\guogang>sq ...

  2. 【开发手记一】老生常谈:简简单单配置ZED板开发环境

    说明:整理之前项目博客,此系列之前发表于与非网 http://www.openhw.org/module/forum/thread-552476-1-1.html 在拿到开发板和配套教材之前,我们小组 ...

  3. Android KitKat 4.4 Wifi移植之Wifi driver

    本文讲述在Linux 3.10下Realek RTL8723A Linux Wifi 驱动的移植. Prerequisites 硬件平台:Atmel SAMA5 软件平台:Linux 3.10 + A ...

  4. KMP原理、分析及C语言实现

    (是在matrix67博客基础上整理而来,整理着:华科小涛@http://www.cnblogs.com/hust-ghtao/) 有些算法可以让人发疯,KMP算法就是一个.在网上找了很多资料讲的都让 ...

  5. Opencv2系列学习笔记8(图像滤波)

    一:概念: 滤波是信号处理机图像处理中的一个基本操作.滤波去除图像中的噪声,提取感兴趣的特征,允许图像重采样. 图像中的频域和空域:空间域指用图像的灰度值来描述一幅图像:而频域指用图像灰度值的变化来描 ...

  6. metasploit学习之ms03_026

    傻瓜式利用ms03_026_dcom: Matching Modules ================ Name Disclosure Date Rank Description ---- --- ...

  7. JavaScript快速入门(三)——JavaScript语句

    JavaScript基本语句 基本概述 JavaScript是脚本语言,从上到下解释执行,最小单位为语句或语句块,每个语句以分号结尾,每个语句块以右大括号结尾. JavaScript可以将多条语句或语 ...

  8. .htaccess和license文件编写

    1 .htaccess 1.1 文件的位置 默认情况下放置于根目录 1.2 .htaccess文件的编写 1.2.1 错误页面跳转 ErrorDocument + 错误码 + 跳转路径/提示文字 eg ...

  9. hdu4847 Wow! Such Doge!(简单题+坑爹的输入)

    转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php ...

  10. openCV中cvSnakeImage()函数代码分析

    /*M/////////////////////////////////////////////////////////////////////////////////////// // // IMP ...