[Offer收割]编程练习赛14 register

Ended

Participants:574

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-16 12:38:17

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <queue>
#include <map>
#include <stack>
using namespace std;
typedef long long ll;
const int maxn = 1005;
int n,a[maxn];
int main() {
  //freopen("in.cpp","r",stdin);
  cin>>n;
  for(int i=0; i<n; i++)cin>>a[i];
   unordered_map<int,int>mp;
  sort(a,a+n);
  for(int i=0;i<n;i++)
  for(int j=i+1;j<n;j++)
  mp[a[i]+a[j]]++;
  unordered_map<int,int>cnt;
  for(int i=0; i<n; i++) {
    int j=i;
    for(int k=i+1; k<n; k++) {
      if(a[k]!=a[i])break;
      j=k;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX