1 条题解
-
0
对于 ,连边:
- (如果 )
这样恰好有 。
此时 有 个路径,其中 是斐波那契数列,且 的路径条数为所有与 有连边的点 的 之和。根据经典结论,控制 到其他点的连边,可以凑出不大于 的所有路径条数,符合题意。
#include <bits/stdc++.h> using namespace std; const int w[24] = {0, 0, 28657, 17711, 10946, 6765, 4181, 2584, 1597, 987, 610, 377, 233, 144, 89, 55, 34, 21, 13, 8, 5, 3, 2, 1}; int main() { freopen("construct.in", "r", stdin); freopen("construct.out", "w", stdout); int p; cin >> p; cout << 24 << ' ' << 65 << endl; for (int i = 2; i <= 22; i++) { cout << 1 << ' ' << i << endl; cout << i << ' ' << i + 1 << endl; cout << i << ' ' << i + 2 << endl; } cout << 1 << ' ' << 23 << endl; cout << 23 << ' ' << 24 << endl; for (int i = 0; i <= p; i++) { string s = "01101101101101101101101101101101101101101101101101101101101101101"; int l = i; for (int j = 2; j <= 23; j++) if (l >= w[j]) { l -= w[j]; s[3 * j - 6] = '1'; } cout << s << endl; } return 0; }
- 1
信息
- ID
- 256
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 6
- 标签
- 递交数
- 29
- 已通过
- 3
- 上传者