Codeforces Round #256 (Div. 2) D. Multiplication Table
主题链接:http://codeforces.com/contest/448/problem/D
思路:用二分法
code:
#include<cstdio>
#include<cmath>
#include<iostream> using namespace std; __int64 n,m,k; __int64 f(__int64 x)
{
__int64 res=0;
for(__int64 i=1;i<=n;i++)
{
__int64 minn=min(m,x/i); //计算第i行有多少个数比x小,而且最多也仅仅要m个数比x小
res+=minn; //计算出比x小的数的共同拥有多少个
}
return res<k;
} int main()
{
while(scanf("%I64d%I64d%I64d",&n,&m,&k)==3)
{
__int64 l=1,r=n*m;
while(l<r)
{
__int64 mid=(l+r)/2;
if(f(mid))l=mid+1;
else r=mid;
}
printf("%I64d\n",l);
}
return 0;
}
版权声明:本文博客原创文章。博客,未经同意,不得转载。
Codeforces Round #256 (Div. 2) D. Multiplication Table的更多相关文章
- Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)
		
转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...
 - 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 Round #256 (Div. 2)   D. Multiplication Table 很有想法的一个二分
		
D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input stand ...
 - 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) 题解
		
Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...
 - Codeforces Round #256 (Div. 2)
		
A - Rewards 水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可 #include <iostream& ...
 - Codeforces Round #256 (Div. 2) Multiplication Table
		
C题, #include<cstdio> #include<cstring> #include<algorithm> #define maxn 5005 using ...
 - Codeforces Round #256 (Div. 2)——Multiplication Table
		
题目链接 题意: n*m的一个乘法表,从小到大排序后,输出第k个数 (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m) 分析: 对于k之前的数,排名小于k:k之后的数大于,那么就能够採用 ...
 - CF  Codeforces Round #256 (Div. 2)   D   (448D)  Multiplication Table
		
二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll l ...
 
随机推荐
- ViewPager.getChildCount() 含义
			
viewpager.getChildCount() 非常easy误解成viewpager子页面的size.它和getCount还是有差别的 getChildCount() 是表示当前可见页size 比 ...
 - 修改linux系统时间、rtc时间以及时间同步
			
修改linux的系统时间用date -s [MMDDhhmm[[CC]YY][.ss]] 但是系统重启就会从新和硬件时钟同步. 要想永久修改系统时间,就需要如下命令:hwclock hwclock - ...
 - uvalive 2911 Maximum(贪心)
			
题目连接:2911 - Maximum 题目大意:给出m, p, a, b,然后xi满足题目中的两个公式, 要求求的 xp1 + xp2 +...+ xpm 的最大值. 解题思路:可以将x1 + x2 ...
 - 集成学习---bagging and boosting
			
作为集成学习的二个方法,其实bagging和boosting的实现比较容易理解,但是理论证明比较费力.下面首先介绍这两种方法. 所谓的集成学习,就是用多重或多个弱分类器结合为一个强分类器,从而达到提升 ...
 - C++0x新特性
			
我是在一个帖子上摘抄的大神语录...感谢supermegaboy大神,给了详尽的解释 下文是一篇转载的Wikipedia的译文,从语言和库双方面概述了C++0x. 右值引用与转移语义 在标准C++语言 ...
 - QVector<QString> 显示器里面的动态数组元素QString和char *转变
			
QVector类是一类提供了动态数组模板. QVector<T>是Qt普通容器类的一种. 它将自己的每个对象存储在连续的内存中.能够使用索引號来高速訪问它们.QList<T>. ...
 - Bulk Insert Data
			
Bulk Insert Data 命名空间:Oracle.DataAccess.Client 组件:Oracle.DataAccess.dll(2.112.1.0) ODP.NET 版本:ODP.NE ...
 - Red Gate系列之六 SQL Test 1.0.12.3 Edition SQL测试工具 完全破解+使用教程
			
原文:Red Gate系列之六 SQL Test 1.0.12.3 Edition SQL测试工具 完全破解+使用教程 Red Gate系列之六 SQL Test 1.0.12.3 Edition S ...
 - Ubuntu下hadoop2.4搭建集群(单机模式)
			
一 .新建用户和用户组 注明:(这个步骤事实上能够不用的.只是单独使用一个不同的用户好一些) 1.新建用户组 sudo addgroup hadoop 2.新建用户 sudo adduser -in ...
 - lua 远程调试 【zeroBrane 使用mobdebug】(good转)
			
最近基于业务需求,学习了如何使用zeroBrane这个IDE实现C/S 模式下的 lua远程调试,废话不多,上效果图: ---------------------------------------- ...