# A

### 题解

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <map>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const int N = 105;

int a[N];
int main() {
int t, n, m, x;
scanf("%d", &t);
while (t--) {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", a+i);
}
for (int i = 0; i < m; i++) {
scanf("%d", &x);
PII ans = PII(1e9, 0);
for (int j = 0; j < n; j++) {
int temp = __builtin_popcount(x ^ a[j]);
ans = min(ans, make_pair(temp, a[j]));
}
printf("%d\n", ans.se);
}
}
return 0;
}


# E

### 题解

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <map>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
LL cube(LL x) {
if (x >= 10000) return 1e12;
return x * x * x;
}
int main() {
LL a, b;
int cas = 1;
while (scanf("%lld%lld", &a, &b) == 2) {
int ans = 0;
LL mx = b * 11, temp;
for (int i = a; cube(i) <= mx; i++) {
for (int j = a; j <= b && (temp = cube(i) + cube(j)) <= mx; j++) {
if (temp % 10 == 3) {
temp /= 10;
if (temp >= a && temp <= b) ans++;
}
}
}
printf("Case %d: %d\n", cas++, ans);
}
return 0;
}

• 点赞
• 评论
• 分享
x

海报分享

扫一扫，分享海报

• 收藏
• 手机看

分享到微信朋友圈

x

扫一扫，手机阅读

• 打赏

打赏

ned_chu

你的鼓励将是我创作的最大动力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文

07-05
12-14 341
08-10
01-18 714
01-24 416
01-20 810
01-26 525