File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ def build_quasiroman_arrow (n : int ) -> str :
2+ # Simple Roman numeral conversion using only I, V, and X
3+ roman_parts = []
4+ num = n
5+ roman_parts .extend (["M" ] * (num // 1000 )) # Add 'X' for each multiple of 10
6+ num %= 1000
7+ roman_parts .extend (["D" ] * (num // 500 )) # Add 'X' for each multiple of 10
8+ num %= 500
9+ roman_parts .extend (["C" ] * (num // 100 )) # Add 'X' for each multiple of 10
10+ num %= 100
11+ roman_parts .extend (["L" ] * (num // 50 )) # Add 'X' for each multiple of 10
12+ num %= 50
13+ roman_parts .extend (["X" ] * (num // 10 )) # Add 'X' for each multiple of 10
14+ num %= 10
15+ roman_parts .extend (["V" ] * (num // 5 )) # Add 'V' for each multiple of 5
16+ num %= 5
17+ roman_parts .extend ([r"/" ] * num ) # Add 'I' for the remainder
18+
19+ # Join with " \! " to form the arrow-like structure
20+ res = "$" + r" \! " .join (roman_parts ) + r" \! $-$\!\!\guilsinglright$"
21+ print (n , res )
22+ return res
You can’t perform that action at this time.
0 commit comments