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 ...
随机推荐
- 昨天上架出现问题,you binary is not optimized for iphone5.。。。。
这个时候只需要加一个lanuch image 就可以了
- SSH登录很慢问题的解决方法
用ssh连其他linux机器,会等待10-30秒才有提示输入密码.严重影响工作效率. 关闭ssh的gssapi认证 用ssh -v user@server 可以看到登录时有如下信息: debug1: ...
- PHP常用的预定义常量
<?php echo 'PHP常用的预定义常量'.'<br><br>'; echo '当前php的版本为(PHP_VERSION):'.PHP_VERSION.'< ...
- 去掉input text后面的叉
如题 input[type=text]::-ms-clear{ display: none; } input::-webkit-search-cancel-button{ display: none; ...
- PHP编码相关函数试题
1.检查字符串在指定的编码里是否有效的函数是什么? 2.获取字符编码的函数是什么? 3.解析 GET/POST/COOKIE 数据并设置全局变量的函数是什么? 4.大小写不敏感地查找字符串在另一个字符 ...
- jQuery实现DIV拖动
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- kafuka常用的shell命令
kafka常用shell命令: ------------------------------------ 1.创建topic bin/kafka-topics.sh --create --zookee ...
- C++中L和_T()之区别
字符串前面加L表示该字符串是Unicode字符串._T是一个宏,如果项目使用了Unicode字符集(定义了UNICODE宏),则自动在字符串前面加上L,否则字符串不变.因此,Visual C++里边定 ...
- PHP配置安全小技巧
- 转:设置Loadrunner负载机临时文件目录
最近在跑稳定性测试 3 X 24小时的时候,发现负载机产生的日志还运行记录等等竟然有100多G! C盘空间不足,但是D盘还有700多G空间呢,怎么让临时文件转移到D盘? 此处分两种情况: 一. 修改本 ...