⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2.txt

📁 本书的页码从自然数1 开始顺序编码直到自然数n。书的页码按照通常的习惯编排
💻 TXT
字号:
#include <iostream> 
#include <string> 

using namespace std; 

int ff(int ii,int k) 
{ 
    int sum = 0; 

    if( k <= 1) return 1; 
    else{ 
            for(int m = ii+1; m <= 26; m++) 
            { 
                sum += ff(m,k-1); 
            } 
            return sum; 
        } 
} 

int gg(int k) 
{ 
    int ss = 0; 
    for(int jj = 1; jj <= 26; jj++) 
    { 
        ss += ff(jj,k); 
    } 

    return ss; 
} 

int main() 
{ 
    int pc = 0; 
    int caseNum = 1; 
     
    //cin>>caseNum; 
     
    int *pResult = new int [caseNum]; 
     
    for(int i = 0; i < caseNum; i++) 
        pResult[i] = 0; 

    while( pc < caseNum ) 
    { 
        int no = 0; 
        int len = 0; 
        string str = ""; 

        cin>>str; 

        len = str.size(); 

        const char* pstr = str.c_str(); 

        if( len <= 1 ) 
        { 
            pResult[pc] = int(*(pstr)) - 96; 
        } 
        else{ 
                int oldNo; 
                if( *(pstr) == 1)   oldNo = 1; 
                else{ 
                    oldNo = 0; 
                } 

                for(int i = 1; i <= len; i++) 
                { 
                    no = int(*(pstr+i-1)) - 96; 
     
                    for(int j = oldNo+1; j < no; j++) 
                    { 
                        pResult[pc] += ff(j,len-i+1);  
                    } 
                     
                    oldNo = no; 
                } 

                pResult[pc] += 1; 
                 
                for(int i = 1; i <= len-1; i++) 
                { 
                    pResult[pc] += gg(i); 
                } 
            } 

        pc++; 
    }
for(int i = 0; i < caseNum; i++) 
        cout<<pResult[i]<<endl; 

    delete []pResult; 

    return 0; 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -