Problem 1002 cable cable cable-2017 ACM/ICPC Asia Regional Shenyang Online
来源:互联网 发布:催收数据安全管理制度 编辑:程序博客网 时间:2024/04/30 06:09
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≤2^32−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 15Sample Output
4
90Hint
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.
#include <iostream>#include <iomanip>#include <algorithm>#include <cstdio>#include <cstring>#include <queue>#include <deque>#include <stack>#include <string>#include <cmath>#include <vector>#include <utility>#include <set>#include <map>#include <sstream>#include <climits>//#pragma comment(linker, "/STACK:1024000000,1024000000")#define pi acos(-1.0)#define INF 2147483647using namespace std;typedef long long LL;typedef pair<int,int > P;int main(){ LL M, K; while (cin>>M>>K) { LL res=(M-K+1)*K; cout<<res<<endl; } return 0;}
- Problem 1002 cable cable cable-2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online 1002 & hdu6195:cable cable cable
- 【2017 ACM/ICPC Asia Regional Shenyang Online 1002】hdu 6195 cable cable cable
- HDU-2017 ACM/ICPC Asia Regional Shenyang Online-1002-cable cable cable
- 2017 ACM/ICPC Asia Regional Shenyang Online 1002 cable cable cable
- 2017 ACM/ICPC Asia Regional Shenyang Online//cable cable cable题解
- 【HDU6195 2017 ACM ICPC Asia Regional Shenyang Online B】【水题 匹配】cable cable cable M个格子任选K个放K个物品的最小连边匹配
- Problem 1002-2017 ACM/ICPC Asia Regional Shenyang Online
- Problem 1004-2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional shenyang Online
- 2015 ACM/ICPC Asia Regional Shenyang Online
- spring自动装配
- anacond + opencv 的安装
- 我的改编古诗
- 用bochs调试mbr--开始调试啦
- Error:Gradle distribution 'https://services.gradle.org/distributions/gradle-3.3-all.zi
- Problem 1002 cable cable cable-2017 ACM/ICPC Asia Regional Shenyang Online
- ImageLoader的默认配置
- 词法作用域之欺骗词法
- poj3237 Tree(树链剖分)
- 转时间复杂度和空间复杂度详解
- Leetcode :2 Add Two Numbers
- XListView上拉加载下拉刷新
- 第四章 分治策略
- Fast Input