-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.cs
More file actions
30 lines (28 loc) · 921 Bytes
/
Copy pathGame.cs
File metadata and controls
30 lines (28 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication69
{
class Program
{
static void Main(string[] args)
{
int Number = int.Parse(Console.ReadLine());
Number = Math.Abs(Number);
int Result=1 ;
int ArrLenght = Number.ToString().Length;
int[] arr = new int[ArrLenght];
for (int i = 0; i < ArrLenght; i++)
{
arr[i] = Number % 10;
Number /= 10;
}
Result = Math.Max(Result, arr[0] + arr[1] + arr[2]);
Result = Math.Max(Result, arr[0] + arr[1] * arr[2]);
Result = Math.Max(Result, arr[0] * arr[1] + arr[2]);
Result = Math.Max(Result, arr[0] * arr[1] * arr[2]);
Console.WriteLine(Result);
}
}
}