http://acm.hdu.edu.cn/showproblem.php?pid=2113
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char s[maxn]; int main() { int n; int cnt = 0; while(~scanf("%d", &n)) { cnt ++; if(cnt != 1) printf("\n"); itoa(n, s, 10); int len = strlen(s); int sum = 0; for(int i = 0; i < len; i ++) { if(s[i] % 2 == 0) sum += (s[i] - ‘0‘); } printf("%d\n", sum); } return 0; }
原文:https://www.cnblogs.com/zlrrrr/p/9417378.html