#include <bits/stdc++.h>
#define int long long
using namespace std;
#define endl '\n'
void work()
{
int n ; cin >> n ;
int num = 1 ;
if(n > 3)
{
cout << 2 << endl ;
}
else {
cout << 1 << endl ;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
while (t--)
{
work();
}
return 0;
}
对于这道题目来说,当节点数为三个的时候,我们可以形成一个三角形的结构,这样直径为1,而当节点数大于等于4个的时候,就可以在菊花图上多加一条边,连接一个点,多出来的边随便连,这样的话直径最大为2;
最后感谢学长@Zvelig1205的支持

京公网安备 11010502036488号