-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA. Marks.cs
57 lines (53 loc) · 1.51 KB
/
A. Marks.cs
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Numerics;
namespace ConsoleApplication25
{
class Solution
{
static void Main(string[] args)
{
var start = Console.ReadLine();
var ans = 0;
if (int.Parse(start) > 0)
{
var l = (start[start.Length - 1] - '0');
if (8 - l > 0)
{
ans = 8 - l;
Console.WriteLine(ans);
return;
}
else
{
var lt = int.Parse(start.Substring(start.Length - 2,2));
ans = Math.Min(80 - lt, 18 - l);
Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);
return;
}
}
else
{
var l = (start[start.Length - 1] - '0');
if (8 - l > 0)
{
var lt = int.Parse(start.Substring(start.Length - 2, 2));
ans = Math.Min(90 - lt, l + 8);
Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);
return;
}
else
{
ans = l - 8;
Console.WriteLine(ans);
return;
}
}
Console.ReadLine();
}
}
}