zhyf • 7天前
using namespace std;
int main() {
long long c, moon, n, d;
scanf("%lld", &n);
for (int i = 1; i <= n; i++) {
scanf("%lld", &d);
c = 0;
long long a = d;
while (a) {
moon = a % 10;
if (moon < 5) {
c += moon;
} else {
c += moon % 5 + 1;
}
a= a / 10;
}
cout << c << endl;
}
return 0;
}
评论:
请先登录,才能进行评论