社区讨论
样例已过,0分求调
B3956[GESP202403 三级] 字母求和参与者 5已保存回复 5
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 5 条
- 当前快照
- 1 份
- 快照标识符
- @m4ciiyvv
- 此快照首次捕获于
- 2024/12/06 16:57 去年
- 此快照最后确认于
- 2025/11/04 13:17 4 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
cin >> n;
cin >> s;
int ans = 0;
for (int i = 0; i < n; i++){
if (s[i] >= 'a' && s[i] <= 'z') ans += s[i] - 97 + 1;
else if (s[i] >= 'A' && s[i] <= 'Z') ans = ans + s[i] - 65 - 65;
}
cout << ans;
return 0;
}
回复
共 5 条回复,欢迎继续交流。
正在加载回复...