Find an algorithm to select the obtained value in the reverse direction.

has a select drop-down box with five option elements with value values from 1 to 5

<select>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
</select>

now there is a need to change the value to 5 when you choose 1. The corresponding relationship is
1-5
2-4
3-3
4-2
5-1
of course I can use switch to judge the five options in turn. (of course this is not the case in the current business)
I hope to solve this problem from an algorithm point of view? Is there any good way?

Mar.18,2021

can't you see that their sum is all 6? The maximum value + 1-the selected value is fine

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35a99-2bfdd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35a99-2bfdd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?