CodeForces 609B The Best Gift
统计+枚举
- #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的更多相关文章
- 【Codeforces 912E】Prime Gift
Codeforces 912 E 题意:给\(n\leq16\)个素数\(p_1..p_n\),求第\(k\)个所有质因数都在\(n\)个数中的数. 思路:折半搜索...我原来胡搞毛搞怎么也搞不动\( ...
- Codeforces 912 E.Prime Gift (折半枚举、二分)
题目链接:Prime Gift 题意: 给出了n(1<=n<=16)个互不相同的质数pi(2<=pi<=100),现在要求第k大个约数全在所给质数集的数.(保证这个数不超过1e ...
- codeforces 609B
#include<bits/stdc++.h> using namespace std; ]; int main() { memset(num,,sizeof(num)); int n,m ...
- 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 ...
- CodeForces 76A Gift - 最小生成树
The kingdom of Olympia consists of N cities and M bidirectional roads. Each road connects exactly tw ...
- 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift
题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...
- Codeforces H. Prime Gift(折半枚举二分)
题目描述: Prime Gift time limit per test 3.5 seconds memory limit per test 256 megabytes input standard ...
- codeforces 505A. Mr. Kitayuta's Gift 解题报告
题目链接:http://codeforces.com/problemset/problem/505/A 题目意思:给出一个长度不大于10的小写英文字符串 s,问是否能通过在字符串的某个位置插入一个字母 ...
- 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 ...
随机推荐
- easyui 动态渲染
$.parser.parse 这个 $("div[data-easyuisrc]").html(function () { var url = $(this).attr(&qu ...
- Ansible1:简介与基本安装【转】
Ansible是一个综合的强大的管理工具,他可以对多台主机安装操作系统,并为这些主机安装不同的应用程序,也可以通知指挥这些主机完成不同的任务.查看多台主机的各种信息的状态等,ansible都可以通过模 ...
- 严格递增类的dp Codeforces Round #371 (Div. 1) C dp
http://codeforces.com/contest/713 题目大意:给你一个长度为n的数组,每次有+1和-1操作,在该操作下把该数组变成严格递增所需要的最小修改值是多少 思路:遇到这类题型, ...
- s7-300 第一讲
s7-300的电源模块可选,s7-400必选
- **ERROR: Ninja build tool not found.
| if which ninja-build ;\| then \| ln -s `which ninja-build` bin/ninja ;\| else \| echo "***ERR ...
- SQL SERVER中强制类型转换cast和convert的区别
在SQL SERVER中,cast和convert函数都可用于类型转换,其功能是相同的, 只是语法不同. cast一般更容易使用,convert的优点是可以格式化日期和数值. 代码 select CO ...
- C#中partial关键字
1. 什么是局部类型? C# 2.0 引入了局部类型的概念.局部类型允许我们将一个类.结构或接口分成几个部分,分别实现在几个不同的.cs文件中. 局部类型适用于以下情况: (1) 类型特别大,不宜放在 ...
- jquery 仿购物车的加减数量
<p>单价:3.95</p> <input id="min" name="" type="button" va ...
- c++绘图软件<一>
准备写一个绘图软件,参考了三层架构(表现层.业务逻辑层.数据访问层). //////////////////////////////////////////////////////////////// ...
- 添加一个Application Framework Service
如何添加一个Application Framework Service(without native code)? 1.本文参照AlarmManagerService实现一个简单的Applicatio ...