#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; typedef long long LL; const int N = 1 << 17; LL a[N]; int main(){     int n, m, x;     while(scanf("%d%d",&n,&m)!=EOF) {         for (int i = 1; i <= n; i++) {             scanf("%d", &x);             a[x]++;         }         for (int i = 0; i < N; i++) {             a[i] = a[i] * 2;         }         for(int i = 1; i < N; i <<=1) {             for(int j = 0; j < N; j +=(i<<1)) {                 for (int k = 0; k < i; k++) {                     LL x0 = a[j + k];                     LL x1 = a[i + j + k];                     a[j + k] = x0 - x1;                     a[i + j + k] = x0 + x1;                 }             }         }         for (int i = 0; i < N; i++) {             a[i] = a[i] * a[i];         }         for(int i = 1; i < N; i <<=1) {             for(int j = 0; j < N; j +=(i<<1)) {                 for (int k = 0; k < i; k++) {                     LL x0 = a[j + k];                     LL x1 = a[i + j + k];                     a[j + k] = (x0 + x1) / 2;                     a[i + j + k] = (x1 - x0) / 2;                 }             }         }         LL ans=0;         for (int i = m + 1; i < N; i++) {             ans +=a[i]/8;         }         printf("%lld\n", ans);     }     return 0; }
点赞 评论

相关推荐

11-03 14:57
西北大学 营销
Belltrix:其实就是每根转动一定的角度
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务