统计+枚举

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std; int a[]; int main()
{
int n,m;
scanf("%d%d",&n,&m);
memset(a,,sizeof a);
for(int i=;i<=n;i++)
{
int x;
scanf("%d",&x);
a[x]++;
}
int ans=;
for(int i=;i<=m;i++)
{
for(int j=i+;j<=m;j++)
{
ans=ans+a[i]*a[j];
}
}
printf("%d\n",ans);
return ;
}

CodeForces 609B The Best Gift的更多相关文章

  1. 【Codeforces 912E】Prime Gift

    Codeforces 912 E 题意:给\(n\leq16\)个素数\(p_1..p_n\),求第\(k\)个所有质因数都在\(n\)个数中的数. 思路:折半搜索...我原来胡搞毛搞怎么也搞不动\( ...

  2. Codeforces 912 E.Prime Gift (折半枚举、二分)

    题目链接:Prime Gift 题意: 给出了n(1<=n<=16)个互不相同的质数pi(2<=pi<=100),现在要求第k大个约数全在所给质数集的数.(保证这个数不超过1e ...

  3. codeforces 609B

    #include<bits/stdc++.h> using namespace std; ]; int main() { memset(num,,sizeof(num)); int n,m ...

  4. Codeforces Educational Codeforces Round 3 B. The Best Gift 水题

    B. The Best Gift 题目连接: http://www.codeforces.com/contest/609/problem/B Description Emily's birthday ...

  5. CodeForces 76A Gift - 最小生成树

    The kingdom of Olympia consists of N cities and M bidirectional roads. Each road connects exactly tw ...

  6. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

  7. Codeforces H. Prime Gift(折半枚举二分)

    题目描述: Prime Gift time limit per test 3.5 seconds memory limit per test 256 megabytes input standard ...

  8. codeforces 505A. Mr. Kitayuta's Gift 解题报告

    题目链接:http://codeforces.com/problemset/problem/505/A 题目意思:给出一个长度不大于10的小写英文字符串 s,问是否能通过在字符串的某个位置插入一个字母 ...

  9. CF# Educational Codeforces Round 3 B. The Best Gift

    B. The Best Gift time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

随机推荐

  1. Ansible10:Playbook的角色与包含【转】

    当单个playbook文件越来越大的时候,我们就需要重新来组织Playbooks了.我们可以将一个大的playbook拆成若干个小的playbook文件,然后通过include的方式,在主配置文件中将 ...

  2. actor

    _timcharper1月 20 02:18 @timcharper , so what app the actor model can help, and what app the thread m ...

  3. jsonarray和jsonobject

    JSONArray ja = new JSONArray(); ja.put("11"); ja.put("22"); ja.put("33" ...

  4. Petit FatFs

    FatFs is a generic FAT/exFAT file system module for small embedded systems. The FatFs module is writ ...

  5. 转 12C 连接CDB和PDB

    来源:David Dai -- Focus on Oracle 连接到CDB 和普通实例一样的连接. 指定ORACLE_SID 以后可以使用OS认证,也可以使用密码进行连接. [oracle@Ora1 ...

  6. 拖动滚动条时某一处相对另一处固定不动(position:fixed)

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...

  7. Integer比较值的时候小心使用

    package integerdemo; public class IntegerDemo { public static void main(String[] args) { //-128--127 ...

  8. Mysql主从备份、主主备份

    简单介绍mysql双机,多机异地热备简单原理实战. 双机热备的概念简单说一下,就是要保持两个数据库的状态自动同步.对任何一个数据库的操作都自动应用到另外一个数据库,始终保持两个数据库数据一致. 这样做 ...

  9. Python文件打包成EXE文件

    工具:pyinstaller 安装:pip install pyinstaller 使用: 1 将依赖文件集中到一个文件夹:           pyinstaller -D -w xxx.py    ...

  10. xdebug 安装

    如果是这样的话,请参考 http://www.mengyunzhi.com/share/php/107-xdebug.html 进行xdebug的安装.