2017 ACM/ICPC Asia Regional Shenyang Online cable cable cable
2024-10-20 18:58:48
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.
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.
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
没什么要说的
#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+)*m<<endl;
}
}
return ;
}
最新文章
- ASP.NET Core服务器综述
- 在MonthCalendar控件中选中日期
- BZOJ3226: [Sdoi2008]校门外的区间
- 最长上升子序列[LIS]
- oracle连接的三个配置文件(转)
- 【阿里云产品公测】以开发者角度看ACE服务『ACE应用构建指南』
- Ajax时代 SQL注入依然是隐患
- 学习hash_map从而了解如何写stl里面的hash函数和equal或者compare函数
- Button UI Kit CSS3美丽Buttonbutton
- C#基础之------委托
- JS验证两次输入密码是否相同
- GridView 多余字符显示省略号,并在Tooltip中显示完整信息
- PHP算法学习(4) 随机算法
- EF Core中,通过实体类向SQL Server数据库表中插入数据后,实体对象是如何得到数据库表中的默认值的
- 第七章 鼠标(CONNECT)
- SqlServer 中的触发器
- APP-1-相关介绍及资料
- PowerDesigner导入sql脚本生成物理模型
- webpack+sass+vue 入门教程(一)
- 微信小程序尝鲜一个月现状分析