summaryrefslogtreecommitdiff
path: root/PlaygroundCpp/Sources/Playground.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'PlaygroundCpp/Sources/Playground.cpp')
-rw-r--r--PlaygroundCpp/Sources/Playground.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/PlaygroundCpp/Sources/Playground.cpp b/PlaygroundCpp/Sources/Playground.cpp
index 37b59f9..73738d3 100644
--- a/PlaygroundCpp/Sources/Playground.cpp
+++ b/PlaygroundCpp/Sources/Playground.cpp
@@ -1,13 +1,27 @@
#include <iostream>
+using std::cin;
+using std::cout;
-int add(int a, int b) {
- return a + b;
-}
int main() {
- int a = 0;
- int b = 0;
- std::cin >> a;
- std::cin >> b;
- std::cout << add(a, b);
+ int bigger = 0;
+ int biggest = 0;
+ int n;
+ int i;
+ cin >> n;
+
+ for (int j = 0; j < n; j++) {
+ cin >> i;
+ if (i > biggest) {
+ bigger = biggest;
+ biggest = i;
+ } else if (i == biggest) {
+ bigger = i;
+ } else if (i > bigger) {
+ bigger = i;
+ }
+ }
+
+ int64_t prod = (int64_t) bigger * (int64_t) biggest;
+ cout << prod << "\n";
return 0;
}