codeforces D. Multiplication Table
http://codeforces.com/contest/448/problem/D
题意:一个n×m的矩阵,a[i][j]=i*j; 然后把a数组排序,找出第k个数。
思路:1-n×m二分枚举,然后统计比小于等于x的数的个数与k相比较。
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define maxn 1000100
#define ll long long
using namespace std;
const int inf=<<; ll n,m,k;
ll a[maxn];
ll dp[][]; bool ok(ll x)
{
ll cnt=;
for(int i=; i<=n; i++)
{
cnt+=min(x/(ll)i,m);
}
if(cnt>=k) return true;
return false;
} int main()
{
cin>>n>>m>>k;
ll l=,r=n*m;
ll ans;
while(l<=r)
{
ll mid=(l+r)>>;
if(ok(mid))
{
ans=mid;
r=mid-;
}
else l=mid+;
}
cout<<ans<<endl;
return ;
}
codeforces D. Multiplication Table的更多相关文章
- Codeforces 577A - Multiplication Table
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i ...
- CodeForces 577A Multiplication Table 质因子数
题目:click here 题意:看hint就懂了 分析:数论小题,在n0.5时间里求n的质因子数 #include <bits/stdc++.h> using namespace std ...
- Codeforces 1220B. Multiplication Table
传送门 冷静分析容易发现,我们只要能确定一个数的值,所有值也就可以确定了 确定一个数的值很容易,$a_ia_j=M_{i,j},a_ia_k=M_{i,k},a_ja_k=M_{j,k}$ 然后就可以 ...
- 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 ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)
转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...
- 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 ...
- 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 ...
- Codeforces 448 D. Multiplication Table
二分法判断答案 D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes inp ...
- Codeforces 448 D. Multiplication Table 二分
题目链接:D. Multiplication Table 题意: 给出N×M的乘法矩阵要你求在这个惩罚矩阵中第k个小的元素(1 ≤ n, m ≤ 5·10^5; 1 ≤ k ≤ n·m). 题解: n ...
随机推荐
- 如何让MFC程序关闭按钮失效,也无法右击任务栏关闭窗口来关闭?
如何让MFC程序关闭按钮失效,也无法右击任务栏关闭窗口来关闭,即右键任务栏的关闭窗口失效呢?很简单,有一个小窍门就是:响应IDCANCEL消息,具体实现如下: 首先定义消息映射:ON_BN_CLICK ...
- git 远程追踪
$ git branch --set-upstream-to origin/master http://stackoverflow.com/questions/21729560/how-to-make ...
- .net+easyui系列--datagrid
加载CSS <link href="../../Public/easyui/SiteEasy.css" rel="stylesheet" type=&qu ...
- C#中方法的参数修饰符
做项目久了,有的时候真的需要静下心来认真的总结一下自己所用到的技术,而不是每天依葫芦画瓢,每天忙忙碌碌,到头来不知道自己忙了个啥,学了什么,自己到底掌握了多少知识.所以我想回顾一下C#的基础知识,把重 ...
- 使用graphics2D给图片上画字符
//读取图片BufferedImage frontImage = ImageIO.read(new File(eCardXMLConfigManager.geteCardXMLConfigManage ...
- Perl连接Sqlite数据库
Sqlite是一个小巧的嵌入式关系型数据库,几乎可以嵌入所有编程语言,特别是C,C++,PHP,Perl等.这里就介绍如何用Perl连接并操作Sqlite数据库. use DBI; # perl用以操 ...
- 非常的奇葩,终于解决了硬盘从盘盘符消失的问题 http://bbs.gamersky.com/thread-1712710-1-1.html (出处: 游民星空论坛)
本人用电脑也十多年了,硬盘的问题也碰到过不少.但最近却碰到了一个很奇葩的问题.就是安装了一块全新的SSD硬盘当从盘,但在装上之后,在我的电脑中却不显示,没有盘符.不过打开系统磁盘管理却能显示硬盘信息. ...
- oc 获取当前时间
//获取当前日期 NSDate* date = [NSDate date]; NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init]; ...
- linux服务端的网络编程
常见的Linux服务端的开发模型有多进程.多线程和IO复用,即select.poll和epoll三种方式,其中现在广泛使用的IO模型主要epoll,关于该模型的性能相较于select和poll要好不少 ...
- Jquery插件之信息弹出框showInfoDialog(成功、错误、警告、通知)
一.信息种类说明: 1.1.操作成功信息 1.2.错误信息 1.3.警告信息 1.4.通知信息 二.使用说明 <!DOCTYPE html PUBLIC "-//W3C//DTD HT ...