1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 int n = 0; 7 int num[10] = { 0 }; 8 int sum = 0; 9 cin >> n; 10 for (int i = 0; i < n; ++i)cin >> num[i]; 11 for (int i = 0; i < n; i++) { 12 for (int j = i + 1; j < n; ++j) { 13 if (num[i] != 0) sum += num[i] * 10 + num[j]; //保证十位不为零 14 if (num[j] != 0) sum += num[j] * 10 + num[i]; 15 } 16 } 17 cout << sum; 18 return 0; 19 }
今天水水水!