Untitled
unknown
c_cpp
2 years ago
938 B
8
Indexable
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int max_product = 0;
for (int i = 0; i < n; i++) {
int value1 = 0;
bool has_digit = false;
for (char c : arr[i]) {
if (isdigit(c)) {
value1 *= 10;
value1 += c - '0';
has_digit = true;
}
}
if (!has_digit) {
value1 = arr[i].length();
}
for (int j = i + 1; j < n; j++) {
int value2 = 0;
has_digit = false;
for (char c : arr[j]) {
if (isdigit(c)) {
value2 *= 10;
value2 += c - '0';
has_digit = true;
}
}
if (!has_digit) {
value2 = arr[j].length();
}
max_product = max(max_product, value1 * value2);
}
}
cout << max_product << endl;
return 0;
}
Editor is loading...