基本思想:
无;
关键点:
无;
#include<iostream> #include<stdlib.h> #include<stdio.h> #include<vector> #include<string> #include<math.h> #include<algorithm> #include<cstring> using namespace std; using std::vector; vector<int>vec; int main() { string s; while (cin >> s) { int cnt = 0; for (int i = 0; i < s.size(); i++) cnt += s[i] - '0'; vec.push_back(cnt); } for (auto ele : vec) cout << ele << endl; //system("pause"); return 0; }