1 条题解

  • 0
    @ 2026-4-21 18:29:39

    对于 2≤i≤232 \le i \le 23,连边:

    • 1→i1 \to i
    • i→i+1i \to i + 1
    • i→i+2i \to i + 2(如果 i≠23i \ne 23)

    这样恰好有 n=24,m=65n = 24, m = 65。

    此时 i→24i \to 24 有 F25−iF_{25 - i} 个路径,其中 F={1,1,2,3,5,8,…}F = \{1, 1, 2, 3, 5, 8, \ldots\} 是斐波那契数列,且 1→n1 \to n 的路径条数为所有与 11 有连边的点 ii 的 F25−iF_{25 - i} 之和。根据经典结论,控制 11 到其他点的连边,可以凑出不大于 F25−2=75023F_{25} - 2 = 75023 的所有路径条数,符合题意。

    #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
    上传者