609B Load Balancing
题意:有n本书分m个类别,现在你要买两本不属于同一类别的书,问有多少种方案。
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<memory.h>
#define clc(a,b) memset(a,b,sizeof(a))
using namespace std; int n,m;
int a[]; int main()
{
scanf("%d%d",&n,&m);
clc(a,);
for(int i=;i<n;i++)
{
int x;
scanf("%d",&x);
a[x]++;
}
long long int sum=;
for(int i=;i<=m;i++)
{
for(int j=i+;j<=m;j++)
{
sum+=a[i]*a[j];
}
}
cout<<sum<<endl;
return ;
}
609B Load Balancing的更多相关文章
- 【架构】How To Use HAProxy to Set Up MySQL Load Balancing
How To Use HAProxy to Set Up MySQL Load Balancing Dec 2, 2013 MySQL, Scaling, Server Optimization U ...
- CF# Educational Codeforces Round 3 C. Load Balancing
C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Codeforces Educational Codeforces Round 3 C. Load Balancing 贪心
C. Load Balancing 题目连接: http://www.codeforces.com/contest/609/problem/C Description In the school co ...
- UVA 12904 Load Balancing 暴力
Load Balancing Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/vi ...
- Load Balancing 折半枚举大法好啊
Load Balancing 给出每个学生的学分. 将学生按学分分成四组,使得sigma (sumi-n/4)最小. 算法: 折半枚举 #include <iostrea ...
- [zz] pgpool-II load balancing from FAQ
It seems my pgpool-II does not do load balancing. Why? First of all, pgpool-II' load balancing is &q ...
- How Network Load Balancing Technology Works--reference
http://technet.microsoft.com/en-us/library/cc756878(v=ws.10).aspx In this section Network Load Balan ...
- Network Load Balancing Technical Overview--reference
http://technet.microsoft.com/en-us/library/bb742455.aspx Abstract Network Load Balancing, a clusteri ...
- How Node.js Multiprocess Load Balancing Works
As of version 0.6.0 of node, load multiple process load balancing is available for node. The concept ...
随机推荐
- c++ 16 this 和 继承 及继承机制中的构造函数 与 析构函数
#include <iostream> #include <string> using namespace std; class Animal { public: Animal ...
- [转载]线程间操作无效: 从不是创建控件“ListBox1”的线程访问它
解决方法有两种: 1.Control.CheckForIllegalCrossThreadCalls = false 2.用委托解决线程安全问题
- itext 落雨 out of membery Memory Optimization
Memory Optimization If a document deals with a lot of data or large elements, such as images, it is ...
- XoftSpy 4.13的注册算法分析
[标题]XoftSpy 4.13的注册算法分析 [作者]forever[RCT] [语言]VC [工具]ida4.6,ollydbg1.1 [正文] 这个软件的算法很简单,正好拿来做逆向分 ...
- Scala的Pattern Matching Anonymous Functions
参考自http://stackoverflow.com/questions/19478244/how-does-a-case-anonymous-function-really-work-in-sca ...
- IDS 日志分析
[http://blog.csdn.net/cnbird2008/article/details/5792626] General Approach通用方法1. Identify which log ...
- mvc+entity framework database first,生成的model每次更新一个表会更新所有的model
在使用Entity Framework 的Database frist或model first时,直接加attribute到modle类上是太现实也不合理的,因为model类是自动生成的,重新生成后会 ...
- 【POJ 3335】 Rotating Scoreboard (多边形的核- - 半平面交应用)
Rotating Scoreboard Description This year, ACM/ICPC World finals will be held in a hall in form of a ...
- 使用JS创建表格以及隔行换色(包括隔N行换色)
<html> <head> <title></title> <style> table{ width:800px; border-colla ...
- Power Station POJ 4045
题意:给你一棵树,让你求一点,使该点到其余各点的距离之和最小.如果这样的点有多个,则按升序依次输出. 树型dp #include <cstdio> #include <cstring ...