提交时间:2023-05-27 16:41:20
运行 ID: 74602
#include <iostream> #include <string> using namespace std; int main() { string name; cin >> name; int sum = 0; for (char ch : name) { sum += (int) ch; // 把字符转换成对应的 ASCII 码值 } cout << sum << endl; return 0; }