#P6857. 梦中梦与不再有梦
梦中梦与不再有梦
Description
Amazing John wants to make a problem based on his dreams.
Amazing John had dreams. Between every pair of dreams, there is exactly one bridge directly connecting them, and no bridge connects a dream to itself.
By crossing a bridge , you can go from dream to dream , or from to , and gain rest point.
For every bridge , it can only be crossed once, no matter whether you cross it forward or backward.
When you arrive at a dream and all bridges connected to it can no longer be crossed, Amazing John will stop dreaming.
Now Amazing John is very sleepy. He wants to know: starting from any dream, what is the maximum number of rest points he can obtain?
Input Format
This problem has multiple test cases.
The first line contains a positive integer , meaning there are test cases.
Next are lines. Each line contains a positive integer , meaning he had dreams.
Output Format
Output a total of lines.
For each test case, output one positive integer , meaning the maximum rest points that can be obtained.
1
3
3
Hint
Sample explanation:
Start from , go along to reach , then along to reach , and finally along to reach .
In total, you gain rest points.
| Subtask | Test Points | Constraints | Score |
|---|---|---|---|
For a subtask, you can get its score if and only if you pass all test points in that subtask.
Translated by ChatGPT 5
京公网安备 11011102002149号