害怕
查看原帖
害怕
519605
Seven_tc楼主2024/4/27 14:08

写完了之后感觉不会这么简单吧,又看一眼三级,难道会在数据量上下坑,但是,,也没有,很神奇

#include <iostream>
#include <cctype>
using namespace std;
int n,cnt;
string s;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin >> n>>s;
	for(char c:s){
		if(islower(c))cnt+=c-96;
		else if (isupper(c)) cnt-=c;
	}
	cout<<cnt;

	return 0;
}

2024/4/27 14:08
加载中...