2017 ACM/ICPC Asia Regional Shenyang Online cable cable cable
2017-09-19 09:42
477 查看
[align=left]Problem Description[/align]
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.
[align=left]Input[/align]
Multiple cases (no more than 100), for each test case:
there is one line contains two integers M and K.
[align=left]Output[/align]
Output the minimum number of cables N.
[align=left]Sample Input[/align]
3 2
20 15
[align=left]Sample Output[/align]
4
90
没什么要说的
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.
[align=left]Input[/align]
Multiple cases (no more than 100), for each test case:
there is one line contains two integers M and K.
[align=left]Output[/align]
Output the minimum number of cables N.
[align=left]Sample Input[/align]
3 2
20 15
[align=left]Sample Output[/align]
4
90
没什么要说的
#include <bits/stdc++.h> using namespace std; int main(){ long long n,m; while(cin>>n>>m){ if(n<=m){ cout<<n<<endl; }else{ cout<<(n-m+1)*m<<endl; } } return 0; }
相关文章推荐
- HDU-2017 ACM/ICPC Asia Regional Shenyang Online-1002-cable cable cable
- 2017 ACM/ICPC Asia Regional Shenyang Online 1002 & hdu6195:cable cable cable
- 【HDU6195 2017 ACM ICPC Asia Regional Shenyang Online B】【水题 匹配】cable cable cable M个格子任选K个放K个物品的最小连边匹配
- Problem 1002 cable cable cable-2017 ACM/ICPC Asia Regional Shenyang Online
- 【2017 ACM/ICPC Asia Regional Shenyang Online 1002】hdu 6195 cable cable cable
- 2017 ACM/ICPC Asia Regional Shenyang Online 1002 cable cable cable
- 2017 ACM/ICPC Asia Regional Shenyang Online//cable cable cable题解
- 2017 ACM/ICPC Asia Regional Shenyang Online:transaction transaction transaction
- 2017 ACM/ICPC Asia Regional Shenyang Online 1008 transaction transaction transaction
- 2017 ACM/ICPC Asia Regional Shenyang Online 1005 number number number (HDU6198)
- HDU 6201 transaction transaction transaction (Dijstra, 2017 ACM/ICPC Asia Regional Shenyang Online)
- 2017 ACM/ICPC Asia Regional Shenyang Online
- 【HDU6199 2017 ACM ICPC Asia Regional Shenyang Online F】【博弈 DP】gems gems gems 双人从左侧拿宝石 每次拿相同或加一的最小差值
- HDU 6199 gems gems gems (DP, 2017 ACM/ICPC Asia Regional Shenyang Online)
- 2017 ACM/ICPC Asia Regional Shenyang Online//number number number
- HDU-2017 ACM/ICPC Asia Regional Shenyang Online-1005-number number number
- HDU6200 mustedge mustedge mustedge (2017 ACM/ICPC Asia Regional Shenyang Online)
- 2017 ACM/ICPC Asia Regional Shenyang Online【solved:7 / 12】
- HDU-2017 ACM/ICPC Asia Regional Shenyang Online-1008-transaction transaction transaction
- 2017 ACM/ICPC Asia Regional Shenyang Online 1005 & hdu6198:number number number