• 数字转化罗马数字的函数


    Public Function mfH00R0_Get_RomanNumerals(intNum As Long) As String
       
        Dim intArabic(12) As Integer
        Dim strRoman(12) As String
        Dim intI As Integer
        Dim strOut As String

        intArabic(0) = 1000
        intArabic(1) = 900
        intArabic(2) = 500
        intArabic(3) = 400
        intArabic(4) = 100
        intArabic(5) = 90
        intArabic(6) = 50
        intArabic(7) = 40
        intArabic(8) = 10
        intArabic(9) = 9
        intArabic(10) = 5
        intArabic(11) = 4
        intArabic(12) = 1
        strRoman(0) = "M"
        strRoman(1) = "CM"
        strRoman(2) = "D"
        strRoman(3) = "CD"
        strRoman(4) = "C"
        strRoman(5) = "XC"
        strRoman(6) = "L"
        strRoman(7) = "XL"
        strRoman(8) = "X"
        strRoman(9) = "IX"
        strRoman(10) = "V"
        strRoman(11) = "IV"
        strRoman(12) = "I"

        intI = 0

        While intNum
            While intNum >= intArabic(intI)
                intNum = intNum - intArabic(intI)
                strOut = strOut & strRoman(intI)
            Wend
            intI = intI + 1
        Wend

        mfH00R0_Get_RomanNumerals = strOut

    End Function

  • 相关阅读:
    BZOJ 1191 HNOI2006 超级英雄hero
    BZOJ 2442 Usaco2011 Open 修建草坪
    BZOJ 1812 IOI 2005 riv
    OJ 1159 holiday
    BZOJ 1491 NOI 2007 社交网络
    NOIP2014 D1 T3
    BZOJ 2423 HAOI 2010 最长公共子序列
    LCA模板
    NOIP 2015 D1T2信息传递
    数据结构
  • 原文地址:https://www.cnblogs.com/topboy168/p/460394.html
Copyright © 2020-2023  润新知