您的位置:首页 > 其它

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



没什么要说的

#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐