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 ...
随机推荐
- 自定义String类,并且实现在STL容器中添加自定义的类型
13.44 编写标准库string类的简化版本,命名String.你的类应该至少有一个默认构造函数和一个接受C风格字符串指针参数的构造函数.使用allocator为你的String类分配所需内存. 1 ...
- Mysql 进阶操作
将已经存在表设置自动增长属性alter table student change id id int not null auto_increment primary key;(注:这个地方一定是原来就 ...
- SpringMVC项目学习1_web.xml
最近接触的所有项目都是SpringMVC+ajax的项目,因此以一个项目为例学习下. --------------------------------------------------------- ...
- Android 自定义View修炼-自定义View-带百分比进度的圆形进度条(采用自定义属性)
很多的时候,系统自带的View满足不了我们功能的需求,那么我们就需要自己来自定义一个能满足我们需求的View,自定义View我们需要先继承View,添加类的构造方法,重写父类View的一些方法,例如o ...
- linux64下安装swftools
在文档转换器中,需要在linux上安装swftools,经历了一番曲折过程终于安装成功.swftools安装包从http://www.swftools.org/download.html上面下载. 在 ...
- jQuery给CheckBox添加事件
<asp:CheckBox ID="ckbTable" runat="server" Checked="false" /> &l ...
- 菱形实现气泡Bubble,菱形画箭头,菱形画三角形
菱形实现气泡Bubble,菱形画箭头,菱形画三角形 >>>>>>>>>>>>>>>>>>&g ...
- MYSQL批处理
待更新 版权声明:本文为博主原创文章,未经博主允许不得转载.
- U3D 抛物线的方法
本文转载:http://www.manew.com/thread-44642-1-1.html 无论是愤怒的小鸟,还是弓箭发射功能,亦或者模拟炮弹受重力影响等抛物线轨迹,都可以使用本文的方法,模拟绝对 ...
- CentOS PHP-5.4.8 编译安装之初体验
1. 下载5.4.8 版本 [root@Test data] wget http://museum.php.net/php5/php-5.4.8.tar.gz 2. 解压 [root@Test php ...