codeforces 609B
#include<bits/stdc++.h>
using namespace std;
int num[];
int main()
{
memset(num,,sizeof(num));
int n,m,x;
cin >> n >> m;
for(int i=;i<n;i++)
{
cin >> x;
num[x]++; //统计每一个数字出现的次数
}
long long sum=;
for(int j,i=;i<;i++)
for(j=i+;j<=;j++)
sum+=num[i]*num[j]; //然后组合
cout << sum << endl;
}
codeforces 609B的更多相关文章
- CodeForces 609B The Best Gift
统计+枚举 #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
随机推荐
- QT_获取运行进程所在目录路径_2
QString getProcessFullPath(const quint64 &processId) { #ifdef Q_OS_WIN // access process path WC ...
- HttpClient 该知道一些概念
HttpClient 该知道不该知道的一些事 一.简介: Apache开源项目: http://hc.apache.org/ 基于HTTP协议提供强大的支持,构建HTTP客户端应用程序 执行HTTP协 ...
- input的表单验证(不断更新中~~)
1 手机号验证 <input type="tel" id="phone" name="phone" placeholder=" ...
- node.js(二)各种模块
我们知道Node.js适合于IO密集型应用,不适合于CPU密集型应用. JS和Node.js区别: JS运行于客户端浏览器中,存在兼容性问题:数据类型:值类型+引用类型(ES+D ...
- 洛谷2591BZOJ2298 problem a题解
题目连接 bz链接 我们发现,如果一个人有ai个分数比他高的人,有bi个分数比他低的人 那么按照分数排序后,区间[ai+1,n-bi]中的人分数便是相同的 这样就将一个人转化为一个区间 也许有很多人的 ...
- HTML/CSS学习之 三列布局,其中左侧和右侧的部分宽度固定,中间部分宽度随浏览器宽度的变化而自适应变化
第一种方法:绝对定位 <!DOCTYPE html> <html> <head> <title>三列布局</title> <link ...
- Laravel 单设备登录
https://laravel-china.org/articles/10605/laravel-single-device-login 前几天在 laracasts 看了laravel5.6的新功能 ...
- hdu1848 sg打表
果然是神器. #include<stdio.h> #include<string.h> #define maxn 1002 ],sg[maxn],hash[maxn]; voi ...
- this的作用
1.在一般函数方法中使用 this 指代全局 function test(){ this.x = 1; alert(this.x); } test(); // 1 2.作为对象方法调用,this ...
- React Native错误汇总(持续更新)
错误1 Element type is invalid-: 错误描述: Element type is invalid: expected a String(for built-in componen ...