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 ...
随机推荐
- 设置 zend studio 默认编码为UTF8
今天用zend studio 打开文件时发现为乱码,这肯定是编码出了问题,我看了一下果然是编码出了问题,默认的是以GBK编码方式打开,我换utf8编码打开就好了,换编码打开的方法是: 1点击工具栏中的 ...
- Unix/Linux周边环境C编程新手教程(1) Solaris 11 64bit环境结构
Unix/Linux许多的版本号.我们推荐Unix/Linux刚開始学习的人选用几款典型的Unix/Linux操作系统进行学习. 本文就带大家来安装Solaris 11 64位而且配置好C/C++开发 ...
- Oracle SQL Lesson (2) - 限制和排序数据
重建scott用户@?/rdbms/admin/utlsampl.sql@--执行?--$ORACLE_HOME 字符区分大小写:SELECT last_name, job_id, departmen ...
- Mercurial简介
前言 目前所在的公司的版本控制使用的是Mercurial,它也有一个对应的客户端小乌龟,但是Mercurial跟我们之前使用的SVN有着本质的区别,对于其区别会在下一篇中介绍到,这次主要是带领 ...
- 使用SharePoint管理中心管理服务
使用SharePoint管理中心管理服务 为了管理服务应用程序.场管理员要么使用管理中心,要么使用PowerShell. 管理服务应用程序页面列出了场上执行的服务.你能够管理他们. 很多服务都有自己的 ...
- spring问题排查-调低日志等级
问题描写叙述 1. 页面经过一次改动后,提交后页面出现400错误,可是后台并没有输出不论什么错误信息. 2. debug监听应页面对应的提交链接也没有不论什么反应(没有进入后台的controller方 ...
- C++第11周(春)项目1 - 存储班长信息的学生类
课程首页在:http://blog.csdn.net/sxhelijian/article/details/11890759,内有完整教学方案及资源链接 [项目1 - 存储班长信息的学生类] clas ...
- android笔记6——intent的使用
今天挑出一节专门来说一下使用intent和intentfilter进行通信. 场景:一个Activity启动还有一个Activity. 前面已经讲了Fragment的切换,Fragment顾名思义是基 ...
- abstract修改方法
abstract这种方法修饰,主要用在抽象类和抽象方法. 抽象的类是不可实例化的比如 public abstract class Test{ } 他能够含有抽象的方法 public abstract ...
- [Sqlite]-->Java采用jdbc联系Sqlite各种特定的工艺数据库的数据操作
引: 1, Sqlite在Windows.Linux 和 Mac OS X 上的安装过程 2.嵌入式数据库的安装.建库.建表.更新表结构以及数据导入导出等等具体过程记录 3,嵌 ...