-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (18 loc) · 711 Bytes
/
Program.cs
File metadata and controls
25 lines (18 loc) · 711 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
using System;
using System.Linq;
namespace Jumping_on_the_Clouds_Revisited {
class Program {
public static int JumpingOnClouds(int[] ar, int k) {
if (ar.Length % k != 0) return 80;
return 100 - (ar.Length / k + (ar.Where((v, i) => i % k == 0).Sum() * 2));
}
static void Main(string[] args) {
string[] nk = Console.ReadLine().Split(' ');
int n = Convert.ToInt32(nk[0]);
int k = Convert.ToInt32(nk[1]);
int[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), arTemp => Convert.ToInt32(arTemp));
int result = JumpingOnClouds(ar, k);
Console.WriteLine(result);
}
}
}