CodeForce---Educational Codeforces Round 3 The best Gift 解题报告
对于这题笔者认为可以用数学排列来算,但是由于笔者很懒所以抄了一段大神的代码来交个大家了,
这位大神的基本想法就是通过记录各类书的数量,再暴力破解;
下面贴出这位大神的代码吧:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; int h[];
int main()
{
int n,m;
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
{
int x;scanf("%d",&x);
h[x]++;
}
long long ans = ;
for(int i=;i<=m;i++)
for(int j=i+;j<=m;j++)
ans+=h[i]*h[j];
cout<<ans<<endl;
}
CodeForce---Educational Codeforces Round 3 The best Gift 解题报告的更多相关文章
- Codeforce |Educational Codeforces Round 77 (Rated for Div. 2)  B. Obtain Two Zeroes
		B. Obtain Two Zeroes time limit per test 1 second memory limit per test 256 megabytes input standard ... 
- codeforces   505A. Mr. Kitayuta's Gift   解题报告
		题目链接:http://codeforces.com/problemset/problem/505/A 题目意思:给出一个长度不大于10的小写英文字符串 s,问是否能通过在字符串的某个位置插入一个字母 ... 
- Codeforces Round #232 (Div. 1) A 解题报告
		A. On Number of Decompositions into Multipliers 题目连接:http://codeforces.com/contest/396/problem/A 大意: ... 
- codeforces  A. Kitahara Haruki's Gift  解题报告
		题目链接:http://codeforces.com/problemset/problem/433/A 题目意思:给定 n 个只由100和200组成的数,问能不能分成均等的两份. 题目其实不难,要考虑 ... 
- [Codeforces Round #194 (Div. 2)] Secret 解题报告 (数学)
		题目链接:http://codeforces.com/problemset/problem/334/C 题目: 题目大意: 给定数字n,要求构建一个数列使得数列的每一个元素的值都是3的次方,数列之和S ... 
- Codeforces Round 319 # div.1 & 2 解题报告
		Div. 2 Multiplication Table (577A) 题意: 给定n行n列的方阵,第i行第j列的数就是i*j,问有多少个格子上的数恰为x. 1<=n<=10^5, 1< ... 
- Codeforces Round #231 (Div2) 迟到的解题报告
		题目A: 给一个火柴等式,可以从左边移动一根到右边,也可以从右边移到左边,但是不能移动“+”,”=“的火柴, 而且加法里面的数都要大于0(很重要的条件),基本上注意到这点的都过了,没注意的都被HACK ... 
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
		Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ... 
- [Educational Codeforces Round 16]E. Generate a String
		[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ... 
随机推荐
- HighCharts 根据spline-plot-bands图,定制自己的图(区间里显示多个数据)
			公司项目里有这样一个需求,根据数据绘图,但是数据很多,不可能每个点每个点的去画,这样显示的数据太密集非常的难看(更显得技术不专业),如图: 所以我和项目经理商量如何显示这个图形,按照他的意思是,按照范 ... 
- mybatis(1):入坑篇
			依赖 <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artif ... 
- 839. Optimal Marks - SPOJ
			You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range ... 
- 3.6 spring-construction-arg 子元素的使用与解析
			对于构造函数子元素是非常常用的. 相信大家也一定不陌生, 举个小例子: public class Animal { public String type; public int age; /** * ... 
- Recommender Systems引言
			我想站在大神肩膀上...貌似是计算所的一个小伙伴... 总结的很好,看得出来有一定的功底.... 不过对于自己看过了的东西,就不愿意再翻看第二遍了.恰好这本书和项亮那本很像,就直接看这本书了.顺便记记 ... 
- <span> <div> 局部 keydown ,keyup事件。页面部分div $(document) 无效,可能焦点,添加焦点。
			前天改一个bug, js 实现的一个 面板拖拉,左右各两个列表,中间面板画线连接,页面左侧列表选中后,key 事件无效.右侧选中确有效,很奇怪,查看源码,左侧选中后,$(document).on(&q ... 
- secureCRT中文字符乱码
			1.远程linux机器.修改环境变量LANG.例如在~/.bash_profile里面添加 export LANG=zh_CN.UTF8 2.本地windows机器.修改SecureCRT的设置.找到 ... 
- linux distribution是什么?
			linux distribution,即Linux发行版,有很多种类,包括Fedora,Ubuntu,Debian,Red Hat,SuSE等,其内核都是差不多的,只是界面设计和功能上各有千秋. 
- QTreeView只显示指定驱动器及其目录,隐藏所有兄弟节点
			MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setup ... 
- 初始化一台linux server来做项目管理和测试
			毕业以后很多没做过这么技术的事情了,不过今年要开始咯. Goal: 练手安装Nginx,并且配置不同的server,后端有Tomcat的(JIRA),有PHP(总得有的),还有Tornado和Node ... 
