You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
const int N = 110;
|
|
|
|
|
int a[N];
|
|
|
|
|
#define x first
|
|
|
|
|
#define y second
|
|
|
|
|
typedef pair<int, int> PII;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
int cnt = 0;
|
|
|
|
|
a[1] = ++cnt, a[128] = ++cnt;
|
|
|
|
|
|
|
|
|
|
queue<PII> q;
|
|
|
|
|
q.push({1, 128});
|
|
|
|
|
|
|
|
|
|
while (q.size()) {
|
|
|
|
|
auto t = q.front();
|
|
|
|
|
q.pop();
|
|
|
|
|
int mid = (t.x + t.y) >> 1;
|
|
|
|
|
a[mid] = ++cnt, a[mid + 1] = ++cnt;
|
|
|
|
|
if (cnt > 32) break;
|
|
|
|
|
q.push({t.x, mid});
|
|
|
|
|
q.push({mid + 1, t.y});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cnt = 0;
|
|
|
|
|
for (int i = 1; i <= 128; i++) {
|
|
|
|
|
if (a[i]) {
|
|
|
|
|
cnt++;
|
|
|
|
|
printf("a[%d]=%d ", i, a[i]);
|
|
|
|
|
if (cnt % 5 == 0) printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 1肯定是1,2肯定是128
|
|
|
|
|
// 3可能是64,也可能是65
|
|
|
|
|
// 4可能是64,也可能是65
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|