zoukankan      html  css  js  c++  java
  • codeforces 758 A

    n 个数

    找到最大的 

    使得每个数都和最大的相等 

    花费求和

    #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 100010
    
    int 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
    ",ans);
        }
        return 0;
    }
  • 相关阅读:
    spi详解
    spi协议
    C语言break,return
    通信协议
    传输层
    网络层
    数据链路层
    物理层
    无线通信
    cpu设计过程
  • 原文地址:https://www.cnblogs.com/cherryMJY/p/6428598.html
Copyright © 2011-2022 走看看