You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
922 B
C++
26 lines
922 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
unsigned long long a[6666];
|
|
unsigned long long b[] = {1ull, 10ull, 100ull, 1000ull, 10000ull, 100000ull, 1000000ull, 10000000ull, 100000000ull, 1000000000ull, 10000000000ull};
|
|
int main()
|
|
{
|
|
//freopen(R"(C:\Users\Administrator\Desktop\coj8\p122.in)", "r", stdin);
|
|
int T, n;
|
|
scanf("%d", &T);
|
|
for (int t = 1; t <= T; t++)
|
|
{
|
|
printf("Case #%d: ", t);
|
|
scanf("%d", &n);
|
|
for (int i = 0; i < n; i++)
|
|
scanf("%llu", a + i);
|
|
unsigned long long refans = numeric_limits<decltype(refans)>::max();
|
|
for (int i = 0; i < n; i++)
|
|
for (int j = 0; j < i; j++)
|
|
refans = max(a[j] * *upper_bound(b, b + 11, a[i]) + a[i], refans);
|
|
printf("Case #%d: %llu\n", t, refans);
|
|
}
|
|
return 0;
|
|
}
|