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的更多相关文章

  1. ICPC 2019-2020 North-Western Russia Regional Contest

    目录 Contest Info Solutions Problem A. Accurate Movement Problem B. Bad Treap Problem E. Equidistant P ...

  2. 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 ...

  3. Managing IIS Log File Storage

    Managing IIS Log File Storage   You can manage the amount of server disk space that Internet Informa ...

  4. Managing the Lifecycle of a Service

    service的生命周期,从它被创建开始,到它被销毁为止,可以有两条不同的路径: A started service 被开启的service通过其他组件调用 startService()被创建. 这种 ...

  5. Android内存管理(4)*官方教程 含「高效内存的16条策略」 Managing Your App's Memory

    Managing Your App's Memory In this document How Android Manages Memory Sharing Memory Allocating and ...

  6. Managing Group Policy with PowerShell

    Overview In this article, I’ll talk about your options when it comes to managing Group Policy using ...

  7. Managing Hierarchical Data in MySQL

    Managing Hierarchical Data in MySQL Introduction Most users at one time or another have dealt with h ...

  8. [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 ...

  9. Managing linux Shell Jobs

    Managing Shell Jobs   When moving jobs between the foreground and background, it may be useful to ha ...

  10. Managing your Actor Systems

    今天偶然得机会,找到一篇不错得文章,现在分享给大家. 原文:http://www.kotancode.com/2013/02/15/managing-your-actor-systems/ If yo ...

随机推荐

  1. 你了解Vim的增删改查吗 ?

    增: 在Vim的Normal模式中输入A/I/O,a/i/o字符进行对应的增加操作. 删 在Vim的Normal模式中, 输入x 删除光标对应的一个字符(4x代表删除4个字符): 输入dd删除光标所在 ...

  2. HunggingFace的镜像加速站

    方法一:使用huggingface 官方提供的 **huggingface-cli** 命令行工具.(1) 安装依赖pip install -U huggingface_hub (2) 基本命令示例: ...

  3. STM32 CubeMX 学习:003-定时器

    背景 上一讲 STM32 CubeMX 学习:外部中断的使用 介绍了如何配置以及操作GPIO外部中断. 这一讲我们介绍定时器的有关概念,并对其中一种进行示范. HOST-OS : Windows-10 ...

  4. 三层交换机vlan间路由

    sw1: [Huawei]vlan batch 10 20 [Huawei]int e0/0/1 [Huawei-Ethernet0/0/1]port link-type access [Huawei ...

  5. springboot 整合 pagehelper

    pom.xml <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pa ...

  6. react上传文件显示上传进度

    Axios 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中.在使用react, vue框架的时候, 如果需要监听文件上传可以使用axios里的onUploadPro ...

  7. MySQL中为什么要使用索引合并(Index Merge)?

    本文分享自华为云社区<[华为云MySQL技术专栏]MySQL中为什么要使用索引合并(Index Merge)?>,作者:GaussDB 数据库. 在生产环境中,MySQL语句的where查 ...

  8. [oeasy]python0136_接收输入_input函数_字符串_str

    输入变量 回忆上次内容 上次研究了 一行赋值多个变量 a = b = 5 a, b = 7, 8   还研究了 标识符的惯用法 python使用的是 snake_case蛇形命名法 用下划线 分隔开小 ...

  9. 在Python中使用SWCNN去除水印

    在Python中使用SWCNN去除水印 说明 首次发表日期:2024-07-17 SWCNN Github官方仓库: https://github.com/hellloxiaotian/SWCNN S ...

  10. UE-自带的HotUpdate【转】

    原文链接:https://baijiahao.baidu.com/s?id=1745200406976270792&wfr=spider&for=pc 这是百度可以直接搜索到的 UE4 ...