forked from hanemin/cs_practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path@2.cs
More file actions
22 lines (22 loc) · 689 Bytes
/
@2.cs
File metadata and controls
22 lines (22 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
namespace _2 {
class Program {
static int n;
static int[] a;
static int Solve() {
Array.Sort(a);
Array.Reverse(a);
for(int i=0;i<a.Length-2;i++)
for(int j=i+1;j<a.Length-1;j++)
for(int k = j + 1; k < a.Length; k++)
if (a[i] < (a[j] + a[k]))
return a[i] + a[j] + a[k];
return 0;
}
static void Main(string[] args) {
n = int.Parse(Console.ReadLine());
a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
Console.WriteLine(Solve());
}
}
}