Codeforces Round #306 (Div. 2)D

本文探讨了如何构建至少包含一个桥边的连接且k-正则的无向图,针对不同k值提供了具体的解决方案,特别是对于奇数和偶数k的情况进行了深入分析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

D. Regular Bridge
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
An undirected graph is called k-regular, if the degrees of all its vertices are equal k. An edge of a connected graph is called a bridge, if after removing it the graph is being split into two connected components.

Build a connected undirected k-regular graph containing at least one bridge, or else state that such graph doesn’t exist.

Input
The single line of the input contains integer k (1 ≤ k ≤ 100) — the required degree of the vertices of the regular graph.

Output
Print “NO” (without quotes), if such graph doesn’t exist.

Otherwise, print “YES” in the first line and the description of any suitable graph in the next lines.

The description of the made graph must start with numbers n and m — the number of vertices and edges respectively.

Each of the next m lines must contain two integers, a and b (1 ≤ a, b ≤ n, a ≠ b), that mean that there is an edge connecting the vertices a and b. A graph shouldn’t contain multiple edges and edges that lead from a vertex to itself. A graph must be connected, the degrees of all vertices of the graph must be equal k. At least one edge of the graph must be a bridge. You can print the edges of the graph in any order. You can print the ends of each edge in any order.

The constructed graph must contain at most 106 vertices and 106 edges (it is guaranteed that if at least one graph that meets the requirements exists, then there also exists the graph with at most 106 vertices and at most 106 edges).

Examples
input
1
output
YES
2 1
1 2
Note
In the sample from the statement there is a suitable graph consisting of two vertices, connected by a single edge.

这个题偶数不行
奇数处理起来需要分成两边

链接桥的那个需要链接k-1个点
然后底下再多两个点

每个点都连那k-1个点
然后多出来的俩互联

偶数不行就是因为没法处理中间那k-1个

其实很早就想到加两个点了
但是没考虑到奇数偶数

所以忽略过去了

是个教训…

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int k;
void shuchu(int tou, int wei)
{
    int nayiquan = k - 1;
    for (int a = tou;a <= wei - 3;a++)
    {
        for (int b = a;b <= wei - 3;b++)
        {
            if (a == b||abs(a-b)==(k-1)/2)continue;
            cout << a << " " << b << endl;
        }
        cout << a << " " << wei - 1<<endl;
        cout << a<<" " << wei - 2 << endl;
        cout << a << " " << wei << endl;
    }
    cout << wei - 1 << " " << wei - 2 << endl;
}
int main()
{
    cin >> k;
    if (k == 1)
    {
        cout << "YES"<<endl;
        cout << "2 1" << endl<<"2 1"<<endl;
        return 0;
    }
    if (k == 2)
    {
        cout << "NO" << endl;
        return 0;
    }
    if (k == 3)
    {
        cout << "YES" << endl;
        cout << "10 15" << endl;
        cout << "1 2" << endl << "1 3" << endl << "1 4" << endl << "2 4" << endl;
        cout << "3 2" << endl << "4 5" << endl << "3 5" << endl << "5 10" << endl;
        cout << "10 6" << endl << "10 7" << endl << "6 9" << endl << "6 8" << endl;
        cout << "7 8" << endl << "7 9" << endl << "8 9" << endl;
        return 0;
    }
    if (k % 2 == 0)
    {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    cout << 2 * k+4 << " " << 2*(3*(k-1)+1+((k-3)/2)*(k-1))+1 << endl;
    cout << k+2 << " " << 2*k + 4<<endl;
    shuchu(1, k + 2);
    shuchu(k + 3, 2 * k + 4);
    return 0;
}
内容概要:本文深入探讨了金属氢化物(MH)储氢系统在燃料电池汽车中的应用,通过建立吸收/释放氢气的动态模型和热交换模型,结合实验测试分析了不同反应条件下的性能表现。研究表明,低温环境有利于氢气吸收,高温则促进氢气释放;提高氢气流速和降低储氢材料体积分数能提升系统效率。论文还详细介绍了换热系统结构、动态性能数学模型、吸放氢特性仿真分析、热交换系统优化设计、系统控制策略优化以及工程验证与误差分析。此外,通过三维动态建模、换热结构对比分析、系统级性能优化等手段,进一步验证了金属氢化物储氢系统的关键性能特征,并提出了具体的优化设计方案。 适用人群:从事氢能技术研发的科研人员、工程师及相关领域的研究生。 使用场景及目标:①为储氢罐热管理设计提供理论依据;②推动车载储氢技术的发展;③为金属氢化物储氢系统的工程应用提供量化依据;④优化储氢系统的操作参数和结构设计。 其他说明:该研究不仅通过建模仿真全面验证了论文实验结论,还提出了具体的操作参数优化建议,如吸氢阶段维持25-30°C,氢气流速0.012g/s;放氢阶段快速升温至70-75°C,水速18-20g/min。同时,文章还强调了安全考虑,如最高工作压力限制在5bar以下,温度传感器冗余设计等。未来的研究方向包括多尺度建模、新型换热结构和智能控制等方面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值