// yukicodr //No.1882 //二次元可変配列 //vector > mass; //vector > memo; //vector memo; //#include "stdafx.h" #include #include #include //list #include //tree #include //連想配列 #include //hash #include //hash #include #include #include //#include using namespace std; #define FMAX(a,b) ((a)>(b)?(a):(b)) #define FMIN(a,b) ((a)<(b)?(a):(b)) #define FCEIL(a,b) ((a)+(b)-1)/(b) #define FOR(x,to) for(x=0;x *b) return (1); else if (*a < *b) return (-1); return (0); } //降順 int compare_down(const ULL * a, const ULL *b) { if (*a > *b) return (-1); else if (*a < *b) return (1); return (0); } int solve(int i, ULL index_flag) { return 0; } ULL N, K; ULL a[100005]; int main() { cin >> N; cin >> K; for (int i=0;i> a[i]; } //降順に並び替える qsort(a, N, sizeof(ULL), (int(*)(const void*, const void*))compare_down); ULL ans = 0; ULL L = 0; ULL R = N-1; ULL key = (L + R) / 2; ULL S = 0; K <<= 1; while (1) { S = (a[key] * a[0]); if (K > S) //降順で並んだ数列の中央で計算した面積がターゲットより小さい場合 { R = key; //境界は前半にある //中央値を更新 key = (L + R)/2;//切り下げ } else { L = key; //境界は後半にある //中央値を更新 //key = (L + R) / 2;//切り下げ key = FCEIL(L + R, 2);//切り上げ } if (R - L < 2) break; } //cout << (key + 1)*(key+1) << endl; ULL single = 0, twice = 0; for (int i = key; i >= 0; i--) { for (int j = i; j >= 0; j--) { S = (a[i] * a[j]); if (S < K) { if (j == i) single++; else twice++; } else break; } } cout << (key + 1)*(key + 1) - (single + twice*2) << endl; //getchar(); return 0; }