3 条题解

  • 1
    @ 2026-10-28 19:13:44

    简便做法

    #include <iostream>
    #include <string>
    using namespace std;
    int main(){
        int key[26] ={
            1,2,3,   
            1,2,3,   
            1,2,3,   
            1,2,3,  
            1,2,3,   
            1,2,3,4,
            1,2,3,   
            1,2,3,4  
        };
        string str;
        getline(cin,str);
        int t=0;
        for (char c:str){
            if (c==' '){
                t+=1;
            }
            else{
                t+=key[c-'a'];
            }
        }
        cout<<t<<endl;
        return 0;
    }
    

    信息

    ID
    1166
    时间
    1000ms
    内存
    32MiB
    难度
    6
    标签
    递交数
    255
    已通过
    88
    上传者