HDU6195
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
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
there is one line contains two integers M and K.
Output
Sample Input
20 15
Sample Output
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的更多相关文章
- hdu6195 cable cable cable(from 2017 ACM/ICPC Asia Regional Shenyang Online)
最开始一直想不通,为什么推出这个公式,后来想了半天,终于想明白了. 题目大意是,有M个格子,有K个物品.我们希望在格子与物品之间连数量尽可能少的边,使得——不论是选出M个格子中的哪K个,都可以与K个物 ...
- hdu6195 cable cable cable
cable cable cable Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
随机推荐
- Java 泛型通配符
package com.waston; import java.util.*; public class Main { public static void main(String[] args) { ...
- 调用notify()后,当前线程执行完synchronized块中的所有代码才会释放锁
package com.pinnet.test; public class Demo { public static void main(String[] args) { Demo demo = ne ...
- 群辉6.1.7安装scrapy框架执行爬虫
只针对会linux命令,会python的伙伴, 使用环境为: 群辉ds3615xs 6.1.7 python3.5 最近使用scrapy开发了一个小爬虫,因为很穷没有服务器可已部署. 所以打起了我那台 ...
- 【xsy3355】图 思维
题目大意:给你一个n个点m条无向边的图,问这个图是否能够: 1,被四染色(用四种颜色给图染色,且相邻点颜色不同). 2,找出一个奇环,满足在原图中去掉这个奇环后每个点依然相邻. 请输出1或者2中的任意 ...
- zookeeper+kafka集群的安装部署
准备工作 上传 zookeeper-3.4.6.tar.gz.scala-2.11.4.tgz.kafka_2.9.2-0.8.1.1.tgz.slf4j-1.7.6.zip 至/usr/local目 ...
- github 最新项目快报
http://www.open-open.com/github/view/github2016-10-17.html
- oracle 异常关闭操作 导致数据库无法正常关闭 也无法启动
场景描述: 在关闭数据库的时候,命令没有打全,导致数据库没有正常关闭 解决办法: 重新建立个连接,然后切换到oracle用户 执行强制关闭数据库: OK 问题解决,不过生产环境 还是不推荐 shutd ...
- Mysql的优化一则
目的在于这么一个sql语句: SELECT w.* FROM wallpaper w inner join wallpaper_category_relation r ON w.wallpaper_i ...
- 小程序/js监听输入框验证金额
refundAmoutInput: function(event){ var value = event.detail.value; if (value.split('.')[0].length &g ...
- JVM 监控工具 jstack 和 jvisualvm 的使用
Java线程状态 线程的五种状态 * 新建:new(时间很短) * 运行:runnable * 等待:waitting(无限期等待),timed waitting(限期等待) * 阻塞:blocked ...