-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSignalTransmission.cs
More file actions
39 lines (37 loc) · 1.03 KB
/
SignalTransmission.cs
File metadata and controls
39 lines (37 loc) · 1.03 KB
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
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Text;
namespace SignalTransmission
{
class SignalTransmission
{
static void Main(string[] args)
{
string input = Console.ReadLine();
string[] arr = input.Split(' ');
List<int> prime = new List<int>();
int m, n;
bool flag = true;
foreach (string a in arr)
{
m = Convert.ToInt32(a);
n = m / 2;
for (int i = 2; i <= n; i++)
{
if (m % i == 0)
{
flag = false;
break;
}
}
if (flag == true)
{
prime.Add(m);
}
}
prime.Sort();
int suffix = prime[prime.Count - 2] + prime.Count;
Console.WriteLine(suffix);
}
}
}