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 ...
随机推荐
- 使用shell脚本自定义实现选择登录ssh
在系统bin目录中建立两个脚本分别是pssh tssh pssh #!/usr/bin/expect -f set ip [lindex ] set port [lindex ] set passwo ...
- linux--每日一个命令
编写shell脚本 hello.sh #!/bin/bash # The first program echo -e "\e[1;34m Hello world ! \e[0m" ...
- 更改JFram标题栏图标
方式一: package com.swing.test; import javax.swing.ImageIcon; import javax.swing.JFrame; public class a ...
- Django 用户认证及OneToOneField
Django 用户认证如果自己不想写 就可以用django自带的认证 首选导入模块 models.py #!/usr/bin/env python #_*_ coding:utf8 _*_ from ...
- wpf中ListBox的选中项与ComboBox间的绑定
产品类: public class Product:NotificationObject { private int productID; public int ProductID { get { r ...
- 【转】Git代码行统计命令集
http://blog.csdn.NET/dwarven/article/details/46550117 http://blog.csdn.net/hshl1214/article/details/ ...
- sed awk 小例
实现数据库批量更新与回滚 create database awktest; use awktest create table user( id int unsigned not null uni ...
- Win32串口API
在工业控制中,工控机(一般都基于Windows平台)经常需要与智能仪表通过串口进行通信.串口通信方便易行,应用广泛. 一般情况下,工控机和各智能仪表通过RS485总线进行通信.RS485的通信方式是半 ...
- C语言根据函数名调用对应的函数
通过函数指针定义,调用时加上参数 struct Command { const char *name; const char *desc; // return -1 to force monitor ...
- Android真机连接手机Target显示unknown cmd命令下adb devices 显示offline
主要原因是adb版本的问题: 1.找到adb.exe路径 比如:G:\BaiduYunDownload\Android\android-sdk\platform-tools,将该路径放到环境便利-- ...