提交时间:2023-08-14 12:00:30
运行 ID: 98093
#include <bits/stdc++.h> using namespace std; int n; const int MX = 2e5+10; int a[MX]; int getNum(int ai) // OK { int sum = 0; do { sum += ai % 10; ai /= 10; } while (ai != 0); return sum; } int Sn(int k) // OK { int 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; } // 缺高精度