L - Who is the Champion

L - Who is the Champion 计蒜客 - 42587

题意:

给出一个N阶矩阵,( i , j ) (i, j)(i,j)处的数字表示这场比赛球队i ii踢进球队j jj多少球。两支球队平局则各加一分,一方获胜则获胜方加三分,负方不加分也不扣分。输出冠军队编号。优先比较分数,分数一样的话比较胜场数,胜场数一样的话输出play-offs。

题解:

队友写的。。
定义一个结构体,然后按照题目算分,排序就完事了

代码:

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int a[200][200];
struct h{
	int k;
	int k1;
	int id;
	int w;
};
h k[200];
bool cmp(h a,h b){
	if(a.w==b.w){
		return (a.k-a.k1)>(b.k-b.k1);
	}
	else
		return a.w>b.w;
}

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		k[i].id=i;
		for(int j=1;j<=n;j++){
			cin>>a[i][j];
			k[i].k+=a[i][j];
		}
	}
	if(n==1){
		printf("1");
		return 0;
	}
	for(int j=1;j<=n;j++){
		for(int i=1;i<=n;i++){
			k[j].k1+=a[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i][j]>a[j][i]){
				k[i].w+=3;
			}
			else if(a[i][j]==a[j][i]){
				k[i].w++;
				k[j].w++;
			}
			else{
				k[j].w+=3;
			}
		}	
	}
	sort(k+1,k+1+n,cmp);

	if(k[1].w==k[2].w&&k[1].k-k[1].k1==k[2].k-k[2].k1){
		printf("play-offs");
	}
	else
		printf("%d",k[1].id);
	return 0;
}
Good evening everyone, I am honored to stand before you today to talk about a topic that is very close to my heart - the power of self-confidence. Self-confidence is the foundation upon which we build our dreams and aspirations. Let me start by sharing some data with you. According to a study by the University of Wolverhampton, individuals with high self-confidence are more likely to succeed in their personal and professional lives, have better mental health, and enjoy a higher quality of life than those with low self-esteem. Now, let's talk about some famous personalities who have inspired us with their self-confidence. Oprah Winfrey, a self-made billionaire, once said, "It doesn't matter who you are, where you come from. The ability to triumph begins with you. Always." She is a living example of how self-confidence can help you overcome obstacles and achieve success. Another inspiring story is that of J.K. Rowling, the author of the Harry Potter series. She was rejected by several publishers before her manuscript was finally accepted. Her self-confidence and belief in her work kept her going, and today she is one of the most successful authors in the world. And who can forget the legendary Muhammad Ali? He was not just a great boxer but also a great believer in himself. He said, "I am the greatest. I said that even before I knew I was." He had unwavering self-confidence and went on to become a world champion. These are just a few examples of how self-confidence can change your life. But the truth is that self-confidence is not something that comes naturally to everyone. It is something that needs to be practiced and nurtured over time. So, how can we develop self-confidence? Firstly, we need to stop comparing ourselves to others. We are all unique individuals with our own strengths and weaknesses. Secondly, we need to focus on our strengths and work on improving them. Thirdly, we need to surround ourselves with positive people who encourage and support us. In conclusion, self-confidence is not just a feeling, it's a mindset. It's about believing in yourself, your abilities, and your dreams. I urge you all to nurture your self-confidence and let it be the driving force behind your success. Thank you.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值