码迷,mamicode.com
首页 > 其他好文 > 详细

CodeForces 609B The Best Gift

时间:2015-12-25 13:19:32      阅读:217      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!