标签:space class bit using pretty map cpp lang main
#include<bits/stdc++.h>
using namespace std;
map <int,int> M;
long long ans;
int main()
{
	int n,a;
	cin>>n;
	while(n--)
	{
		cin>>a;
		for(int i=0;i<=31;i++)
		    ans+=M[(1LL<<i)-a];
		M[a]++;
	}
	cout<<ans;
}利用MAP存数据,防止超时,一开始用了两个for 循环CodeForces - 702B
标签:space class bit using pretty map cpp lang main
原文地址:https://www.cnblogs.com/wangzhelin/p/9152476.html