本文共 1333 字,大约阅读时间需要 4 分钟。
1、
2、题目大意
情人节将至,有n个人分别跟自己喜欢的人约会,给出每个人约会的人编号,如果带走其中一个人,那么喜欢这个人的那些人将会不开心,现在你要带走一个人,使得不开心的人数最多
简单题,不过太心急了,没有注意好边界就提交,导致wrong了两遍才AC
3、题目:
You know the day after tomorrow is Valentine's Day, but I have no girlfriend.
Now, I'll give you a big task, help me take away a person!
If you take away that person, others who want to appointment with him/her will feel disappointed.
Your task is to let maximum people feel disappointed.
3311555222
23
For the first test case.If you take away 1, then 2 and 3 will feel disappointed.If you take away 2, nobody will feel disappointed.If you take away 3, then 1 will feel disappointed.So the maximum people feel disappointed is 2.
4、AC代码:
#include#include #include using namespace std;int b[105];int cmp(int c,int d){ return c>d;}int main(){ int n,a; while(scanf("%d",&n)!=EOF) { memset(b,0,sizeof(b)); for(int i=0;i
转载地址:http://ngddi.baihongyu.com/