2 条题解

  • 0
    @ 2024-4-5 16:33:39
    /*
    int       %d
    longlong  %lld
    float     %f
    double    %lf
    char      %c
    char[]    %s
    'a'=97
    'z'=122
    'A'=65
    'Z'=90
    '0'=48
    '9'=57
    */
    #include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    const int N=1e5+10;
    const int INF=0x3f3f3f3f;
    int a[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},ans;
    string s;
    int main(){
    	getline(cin,s);
    	int len=s.size();
    	for(int i=0;i<len;i++){
    		if(s[i]==' '){
    			ans++;
    		}else{
    			ans+=a[s[i]-'a']; 
    		}
    	}
    	cout<<ans;
    return 0;
    }
    

    信息

    ID
    1166
    时间
    1000ms
    内存
    32MiB
    难度
    5
    标签
    递交数
    123
    已通过
    50
    上传者