B. Powers of Two You are given n integers a1, a2, ..., an. Find the number of pairs of indexes i, j (i < j) that ai + aj is a power of 2 (i. e. some integer xexists so that ai + aj = 2x). Input The first line contains the single positive integer n
个数: var str = 'aaafsdsaaasasasasaa'; var json = {}; for (var i = 0; i < str.length; i++) { if(!json[str.charAt(i)]){ json[str.charAt(i)] = 1; }else{ json[str.charAt(i)]++; } }; console.log(json); var iMax = 0; var iIndex = ''; for(var key in json){ a
<script> var array = new Array(1,2,5,1,4,4,2,3,5,1,1,5,5,5,6,7,3,9,9,10); var arr = new Array(); var test = new Array(); var num = 1; var temp = ""; var size = array.length; for(var i=0;i<size; i++){ for(var j=i+1;j<size; j++){ if(ar
var dataArr = [0,1,2,3,4,5,6,7,8,9,10]; var newArr = []; var s = parseInt(dataArr.length / 4); var n = 0; for (var i = 1; i <= s; i++) { var star = (i - 1) * 4; newArr[n++] = dataArr.slice(star, star + 4); } var y = dataArr.length - s * 4; if (y > 0
include "stdafx.h" #include<iostream> #include<vector> #include <algorithm> #include<iomanip> #include<string> using namespace std; class Solution { public: long long nums = 0; int InversePairs(vector<int> dat