首页 > 其他 > 详细

CodeForces 609B The Best Gift

时间:2015-12-25 13:18:13      阅读:190      评论:0      收藏:0      [点我收藏+]

统计+枚举

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

int a[15];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    memset(a,0,sizeof a);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        a[x]++;
    }
    int ans=0;
    for(int i=1;i<=m;i++)
    {
        for(int j=i+1;j<=m;j++)
        {
            ans=ans+a[i]*a[j];
        }
    }
    printf("%d\n",ans);
    return 0;
}

 

CodeForces 609B The Best Gift

原文:http://www.cnblogs.com/zufezzt/p/5075341.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!