本地样例,测试点都对,在线IDE也对,但全WA
查看原帖
本地样例,测试点都对,在线IDE也对,但全WA
716599
TheCliffSwallow楼主2022/7/22 16:12

rt,我太菜了 :(

#include<iostream>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<cstring>
#include<string>
#include<cctype>
#define ll long long
#define ull unsigned long long
using namespace std;
string s;
int ans;
int cishu(char c){
	if(c==' '||c=='a'||c=='d'||c=='g'||c=='j'||c=='m'||c=='p'||c=='t'||c=='w'){
		return 1;
	}else if(c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7'||c=='8'||c=='9'){
		return 0;
	}else if(c=='z'||c=='s'){
		return 4;
	}else if(c=='b'||c=='e'||c=='h'||c=='k'||c=='n'||c=='q'||c=='u'||c=='x'){
		return 2;
	}else{
		return 3;
	}
}
int main(){
	ios::sync_with_stdio(false);
	getline(cin,s);
	int len=s.size();
	for(int i=0;i<len;i++){
		ans+=cishu(s[i]);
	}
	cout<<ans<<endl;
  	return 0;
}
2022/7/22 16:12
加载中...