hdu-6195 cable cable cable
来源:互联网 发布:wear软件下载 编辑:程序博客网 时间:2024/06/07 22:36
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.
首先让每个屏幕都连一个信号源,用了k根线,然后剩下m-k个屏幕和k个信号源都连起来,所以总数就是k+(m-k)*k,整理后得(m-k+1)*k
#include <iostream>#include <cstdio>#define LL long longusing namespace std;int main(){ LL m,k; while (scanf("%I64d%I64d",&m,&k)!=EOF) { printf("%I64d\n",(m-k+1)*k); } return 0;}
- HDU 6195 cable cable cable
- HDU 6195 cable cable cable
- hdu-6195 cable cable cable
- HDU-6195 cable cable cable(规律)
- HDU 6159 cable cable cable
- 1002 cable cable cable
- HDU6195 cable cable cable
- cable cable cable(水题)
- cable cable cable
- hdu6195 cable cable cable
- HDU6195-cable cable cable
- HDU 6195 cable cable cable (找规律) 2017ACM沈阳赛区网络赛
- 【2017 ACM/ICPC Asia Regional Shenyang Online 1002】hdu 6195 cable cable cable
- HDU6195 cable cable cable 签到
- HDU 6159cable cable cable(简单题)
- hdu-1551 Cable master
- HDU-1551-Cable master
- hdu 1551 Cable master
- Docker技术剖析--dcoker配置Vlan划分
- 江湖二三事:听说你想做数据分析师?
- C 语言循环结构
- 反反爬虫,爬虫突破封禁的6种常见方法
- JAVA贪心算法实现背包问题
- hdu-6195 cable cable cable
- numpy ndarray 按条件筛选数组,关联筛选
- sql基本语句
- Android Gradle使用详解
- 监听器?
- 经过了多种方法的尝试,终于找到Quartus破解成功但是没有办法编译的解决方法
- 如何用最简单的方式解释依赖注入?依赖注入是如何实现解耦的?
- Java日记(6)— 面向对象特性
- [Kotlin]Kotlin二进制读写