提交时间:2023-08-14 16:08:44
运行 ID: 98361
#include <bits/stdc++.h> using namespace std; int n; const int MX = 2e5+10; long long a[MX]; long long getNum(long long ai) // OK { long long sum = 0; do { sum += ai % 10; ai /= 10; } while (ai != 0); return sum; } long long Sn(long long k) // OK { long long sum = 0; for (int ii = 1; ii <= n; ++ii) { sum += getNum(a[ii] + a[k]); } return sum; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; bool tp = 1; for (int i = 1; i <= n; ++i) { cin >> a[i]; } int s = 0; for (int i = 1; i <= n; ++i) { s += Sn(i); } printf("%d", s); return 0; }