Codeforces Round #256 (Div. 2)——Multiplication Table
- 题意:
n*m的一个乘法表,从小到大排序后,输出第k个数
(1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m) - 分析:
对于k之前的数,排名小于k;k之后的数大于,那么就能够採用二分。
LL n, m, k; LL fun(LL goal)
{
LL t = 0, ret = 0;
while (++t <= m)
{
ret += min(n, goal / t);
}
return ret;
} LL bin(LL L, LL R, LL goal)
{
LL M, V;
while (L <= R)
{
M = (L + R) >> 1;
V = fun(M);
if (V < goal)
L = M + 1;
else
R = M - 1;
}
return L;
} int main()
{
// freopen("in.txt", "r", stdin);
while (cin >> n >> m >> k)
{
cout << bin(1, 1e15, k) << endl;
}
return 0;
}
Codeforces Round #256 (Div. 2)——Multiplication Table的更多相关文章
- Codeforces Round #256 (Div. 2) Multiplication Table
C题, #include<cstdio> #include<cstring> #include<algorithm> #define maxn 5005 using ...
- 贪心 Codeforces Round #273 (Div. 2) C. Table Decorations
题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2 ...
- 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 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) D. Multiplication Table
主题链接:http://codeforces.com/contest/448/problem/D 思路:用二分法 code: #include<cstdio> #include<cm ...
- CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table
二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll l ...
随机推荐
- Linux 文件系统(二)---运行过程及结构间的关系
(内核2.4.37) 一.首先.看看磁盘.超级块,inode节点在物理上总体的分布情况: (图示来自:www.daoluan.net) 对于一个分区,相应一个文件系统,一个文件系统事实上本质上还是磁盘 ...
- arcgis jsapi 调用google地区服务
做地理信息系统(GIS)项目,除了实现功能用户体验度要好之外,最重要的是地图渲染效果更要好.很多时候苦于数据的完整性和对于配图的审美观,程序猿们都很难配出好看的地图效果.基于上述一般直接调用googl ...
- 实现Timeline
Redis实现Timeline 上回写了使用Redis实现关注关系,这次说说使用Redis实现Timeline. Timeline的实现一般有推模式.拉模式.推拉结合这几种.推模式:某人发布内容之后推 ...
- 对ORA-01795: 列表中的最大表达式数为 1000的处理(算法:计算数量及切割)
/** * @category * 原:strIDs in ( 100001,100002,100003,....................,110001,120001,130001,1400 ...
- Shiro学习笔记(5)——web集成
Web集成 shiro配置文件shiroini 界面 webxml最关键 Servlet 測试 基于 Basic 的拦截器身份验证 Web集成 大多数情况.web项目都会集成spring.shiro在 ...
- HQApi命令行接口配置
执行的命令行前准备 在您的个人文件夹中第一次创建 型材client.properties 如下面 cd C:\Users\scnyli\ mkdir ".hq" 创建一个 clie ...
- 第三方框架和ARC
在使用了ARC机制的项目中使用第三方开源框架的方法: 1.在第三方开源框架的每个.m文件都设置成 -fno-objc-arc 具体方法:TARGETS--->Build Phases -- ...
- 【剑指offer】q50:树节点最近的祖先
#@ root: the root of searched tree #@ nodeToFind: the tree-node to be found #@ path: the path from r ...
- Eclipse 打JAR包,插件FatJar 安装与使用
下载fatJar插件,解压缩后是一个.../plugins/(net...)把plugins下面的(net..)文件夹拷贝到eclipse的plugins下,重新启动Eclipse3.1,Window ...
- 玩转web之json(五)---将表单通过serialize()方法获取的值转成json
form表单有一个serialize()方法,可以序列化表单的值,但是jquery提供的这个方法会把数据序列化为类似下面的形式: a=1&b=2&c=3&d=4 jquery并 ...