mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 10:18:15 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace problem_1004A
|
||||
{
|
||||
public class problem_1004A
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
int[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
int n = ip[0];
|
||||
int d = ip[1];
|
||||
ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
int id = 1;
|
||||
int count = 2;
|
||||
while (id < n)
|
||||
{
|
||||
if (ip[id] - ip[id - 1] > 2*d)
|
||||
{
|
||||
count += 2;
|
||||
}
|
||||
else if (ip[id] - ip[id - 1] == 2*d)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
Console.Write("{0}", count);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user