Managing Difficulties
1 #include<bits/stdc++.h>
2 using namespace std;
3 #define FOR(i,n,m) for(int i=n;i<=m;i++)
4 //#define gc getchar()
5 inline int read();static char buf[1000000],*pa=buf,*pb=buf;
6 #define gc pa==pb&&(pb=(pa=buf)+fread(buf,1,1000000,stdin),pa==pb)?EOF:*pa++
7 const int N=2010;
8 int n,ct,ak,a[N];
9 map<int,int> m;
10 int main()
11 {
12 int t=read();FOR(i,1,t){
13 m.clear();
14 n=read();ct=0;
15 FOR(i,0,n-1) a[i]=read();
16 m[a[0]]=1;
17 FOR(i,1,n-2)
18 {
19 FOR(j,i+1,n-1)
20 {
21 ak=2*a[i]-a[j];
22 if(ak>=0 && m.count(ak)) ct+=m[ak];
23 }
24 ++m[a[i]];
25 }
26 printf("%d\n",ct);
27 }return 0;
28 }
29
30
31 inline int read()
32 {
33 register int x(0);register char c(gc);bool bbb=1;
34 if(c=='-') {c=gc;}
35 while(c<'0'||c>'9')c=gc;
36 while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc;
37 if(bbb)return x;
38 else return -x;
39 }
Managing Difficulties的更多相关文章
- ICPC 2019-2020 North-Western Russia Regional Contest
目录 Contest Info Solutions Problem A. Accurate Movement Problem B. Bad Treap Problem E. Equidistant P ...
- Managing a node remotely by using the netapp SP
Managing a node remotely by using the Service Processor The Service Processor (SP) is a remote manag ...
- Managing IIS Log File Storage
Managing IIS Log File Storage You can manage the amount of server disk space that Internet Informa ...
- Managing the Lifecycle of a Service
service的生命周期,从它被创建开始,到它被销毁为止,可以有两条不同的路径: A started service 被开启的service通过其他组件调用 startService()被创建. 这种 ...
- Android内存管理(4)*官方教程 含「高效内存的16条策略」 Managing Your App's Memory
Managing Your App's Memory In this document How Android Manages Memory Sharing Memory Allocating and ...
- Managing Group Policy with PowerShell
Overview In this article, I’ll talk about your options when it comes to managing Group Policy using ...
- Managing Hierarchical Data in MySQL
Managing Hierarchical Data in MySQL Introduction Most users at one time or another have dealt with h ...
- [Angular 2] Managing State in RxJS with StartWith and Scan
The scan operator in RxJS is the main key to managing values and states in your stream. Scan behaves ...
- Managing linux Shell Jobs
Managing Shell Jobs When moving jobs between the foreground and background, it may be useful to ha ...
- Managing your Actor Systems
今天偶然得机会,找到一篇不错得文章,现在分享给大家. 原文:http://www.kotancode.com/2013/02/15/managing-your-actor-systems/ If yo ...
随机推荐
- Swin Transformer:最佳论文,准确率和性能双佳的视觉Transformer | ICCV 2021
论文提出了经典的Vision Transormer模型Swin Transformer,能够构建层级特征提高任务准确率,而且其计算复杂度经过各种加速设计,能够与输入图片大小成线性关系.从实验结果来看, ...
- Mac Eclipse 常用快捷键汇总
寻找类:shift+command+t 删除当前行:command+d 上移当前行代码:option+↑ 下移当前行代码:option+↓ 复制当前行至下一行:option+command+↓ 复制当 ...
- MyBatis-Plus 整理
# 前言 代码生成器插件选择去这里:https://www.cnblogs.com/zixq/p/16726534.html 相关插件在那里面已经提到了 # 上手 MyBatis-Plus 是一个 M ...
- 如何在 Vue 项目中优雅地使用图标
1. 字体图标与矢量图标 目前主要有两种图标类型:字体图标和矢量图标. 字体图标是在网页打开时,下载一整个图标库,通常可以通过特定标签例如 <i> 来使用,优点是方便地实现文字混排,缺点是 ...
- UE4 蓝图查找Actor和Actor标签
在用UE4 开发数字孪生应用的过程中,有很多业务会涉及到actor的查找,和actor标签的使用. 比如下面的场景中,找出所有的物联网设备进行标注. 通过类查找actor 通过类查找actor,可以查 ...
- [oeasy]python0125_汉字打印机_点阵式打字机_汉字字形码
汉字字形码 回忆上次内容 IBM 将 ASCII 扩展之后 规定了 一个字节的字符集 并制作了 相应的字形库 添加图片注释,不超过 140 字(可选) 这种显示模式和字符大小之下 中文 ...
- [oeasy]python0108_谷腾堡活字_哥特字体_罗马帝国_希腊文化_文艺复兴
谷腾堡活字 回忆上次内容 上次回顾了字型编码的进化过程 7-seg 七位数码管 显示数字 14-seg 十四位数码管 显示字母 添加图片注释,不超过 140 字(可选) 米字管 ...
- 【VMware VCF】VMware Cloud Foundation Part 01:概述。
VMware Cloud Foundation(简称 VCF)是 VMware 打造的一套用于 Software Defined Data Center(SDDC)软件定义数据中心的全栈云平台解决方案 ...
- vue项目 回到顶部功能 定位在头部
'backBox'是外层容器类名, 根据传入的index,定位在不同的位置 组件: <template> <div class="toTop" @click=&q ...
- 【工具】SpringBoot项目如何查看某个maven依赖是否存在以及依赖链路
当我在SpringBoot项目中想加个依赖,但是不确定现有依赖的依赖的依赖.....有没有添加过这个依赖,怎么办呢?如果添加过了但是不知道我需要的这个依赖属于哪个依赖的下面,怎么查呢? IDEA中提供 ...