codeforces 758 A

 2023-09-11 阅读 26 评论 0

摘要:n 个数 找到最大的 codeforces中文官网?使得每个数都和最大的相等 花费求和 #include<stdio.h> #include<algorithm> #include<string.h> #include<math.h> #include<set> #include<string>using namespace std; typedef long long LL;#

n 个数

找到最大的 

codeforces中文官网?使得每个数都和最大的相等 

花费求和

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<set>
#include<string>using namespace std;
typedef long long LL;#define inf  10000000000000
#define MAXN 100010int co[MAXN];int main()
{int n;while(scanf("%d",&n)!=EOF){int mx=-1;int ans=0;for(int i=0;i<n;i++){scanf("%d",&co[i]);mx=max(mx,co[i]);}for(int i=0;i<n;i++){ans=ans+mx-co[i];}printf("%d\n",ans);}return 0;
}

 

codeforces排名?转载于:https://www.cnblogs.com/cherryMJY/p/6428598.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/45198.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息