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 ...
随机推荐
- Error与Exception的区别
错误和异常的区别(Error vs Exception) 错误和异常的区别(Error vs Exception) 今天面试问了这样一个问题,"Error" 和 "Exc ...
- windows接口被占用
netsh winsock reset 重启winsock服务
- hdu 4472 Count (递推)
Count Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- The OpenGL pipeline
1. Vertex Data 2. Vertex Shader 3. Tessellation Control Shader 4.Tessellation evaluation Shader 5. G ...
- windows phone (16) UI变换 下
原文:windows phone (16) UI变换 下 上一篇中说到四个变换类,都是比较简单的,这里要说到四个变换类,分别为: MatrixTransfrom矩阵变换,一句标准矩阵表示的变换 Tra ...
- STL algorithm算法minmax,minmax_element(36)
minmax原型: std::minmax C++11 C++14 default (1) template <class T> pair <const T&,const T ...
- Google Map API V2密钥申请
之前用的都是v1,用的是MapView,好吧,仅仅能认命了.废话不再多说,開始android 的Google Maps Android API v2吧 之前參考了http://www.cnblogs. ...
- Java 抽象工厂模式
抽象工厂模式(Abstract Factory Pattern)是工厂方法模式的进一步抽象,其英文原话"Provide an interface for creating families ...
- Python re正则表达式
参考: 博客园<Python正則表達式指南> 博客园<Python之re模块> 在此感谢博主的无私奉献,本文主要介绍python中re模块的几个简单使用方法.具体的使用方法请參 ...
- 【HDU】5256 系列转换(上涨时间最长的序列修饰)
假设a[i]和a[j]我想的一样,满足条件的需要是 a[j] - a[i] > j - i 也就是说,a[i] - i < a[j] - j 例1 4 2 不满意,所以1和2必须有必要之间 ...