cable cable cable

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 102    Accepted Submission(s): 89

Problem Description

Connecting the display screen and signal sources which produce different color signals by cables, then the display screen can show the color of the signal source.Notice that every signal source can only send signals to one display screen each time. 
Now you have M display screens and K different signal sources(K≤M≤232−1). Select K display screens from M display screens, how many cables are needed at least so that **any** K display screens you select can show exactly K different colors.
 

Input

Multiple cases (no more than 100), for each test case:
there is one line contains two integers M and K.
 

Output

Output the minimum number of cables N.
 

Sample Input

3 2
20 15
 

Sample Output

4
90

Hint


As the picture is shown, when you select M1 and M2, M1 show the color of K1, and M2 show the color of K2.

When you select M3 and M2, M2 show the color of K1 and M3 show the color of K2.

When you select M1 and M3, M1 show the color of K1.

 

Source

 
 //2017-09-10
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long using namespace std; int main()
{
ll n, k;
while(cin>>n>>k){
cout<<(n-k+)*k<<endl;
} return ;
}

HDU6195的更多相关文章

  1. hdu6195 cable cable cable(from 2017 ACM/ICPC Asia Regional Shenyang Online)

    最开始一直想不通,为什么推出这个公式,后来想了半天,终于想明白了. 题目大意是,有M个格子,有K个物品.我们希望在格子与物品之间连数量尽可能少的边,使得——不论是选出M个格子中的哪K个,都可以与K个物 ...

  2. hdu6195 cable cable cable

    cable cable cable Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

随机推荐

  1. 回车符与换行符问题——C语言

    回车符(carriage return,’\r’)与换行符 (line feed,’\n’) 从上面可以看出换行对应的ASCII码值是10,回车符对应的ASCII码值是13,需要注意的是用户按下回车键 ...

  2. 简单线性回归问题的优化(SGD)R语言

    本编博客继续分享简单的机器学习的R语言实现. 今天是关于简单的线性回归方程问题的优化问题 常用方法,我们会考虑随机梯度递降,好处是,我们不需要遍历数据集中的所有元素,这样可以大幅度的减少运算量. 具体 ...

  3. com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

    出现上述bug的原因如下: 在默认设置下,Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以我们需要禁用它的客户端注册行为. 禁止方式如下:在application.propertie ...

  4. 机器学习与Tensorflow(1)——机器学习基本概念、tensorflow实现简单线性回归

    一.机器学习基本概念 1.训练集和测试集 训练集(training set/data)/训练样例(training examples): 用来进行训练,也就是产生模型或者算法的数据集 测试集(test ...

  5. redis集成相关工具类

    package cn.yiyuan.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; i ...

  6. Jmeter保存时,完美解决提示的“拒绝访问”

    使用Jmeter时,想保存测试计划,提示"拒绝访问“,这是为啥? 因为给Jmeter的权限不够,也就是说,在打开它的时候,直接双击打开,没有选择”以管理员身份运行“,就会导致”拒绝访问“ ! ...

  7. 监控 Redis 服务方案

    RedisLive easy_install pip wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate python g ...

  8. 站在巨人肩上的.NET Core 2.1

    .NET Core 1.0自发布两年以来,得到了开发者群体相当高地认可. 下图来自Stack overflow survey 2018的统计: .NET Core已经成为前五的主流框架工具,现今借鉴了 ...

  9. mycat中间件--linux安装mycat1.6版本

    一.mycat安装前准备1.mycat下载地址,点击此处进行下载2.环境要求如下: mycat使用Java开发,因为用到了JDK 7的部分功能,所以在使用前请确保安装了JDK 7.0,并设置了正确的J ...

  10. jdk8-lambda表达式的使用

    1, 遍历list集合 List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3 ...